Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blockexpr "return" keyword selection #3

Open
JanSharp opened this issue Nov 21, 2021 · 3 comments
Open

blockexpr "return" keyword selection #3

JanSharp opened this issue Nov 21, 2021 · 3 comments

Comments

@JanSharp
Copy link
Owner

JanSharp commented Nov 21, 2021

For info about blockexpr see this issue.

We need a new keyword as a stand in for return for blockexprs (when compared to immediately invoked function expressions (iife))

My ideas so far are

  • leave
  • exit

but I don't like those. If I had to choose between those two I'd go with leave though.

Keep in mind that this keyword will be followed by an (optional) expression list (exactly like return)

@curiosity-a
Copy link

curiosity-a commented Nov 24, 2021

First of all, let's get this out of the way: result should not be a keyword. It is traditionally used as an identifier and should remain that way.

Personally, I don't like leave, it doesn't have the connotation of returning a value. And exit has the connotation of ending the entire program.

Now for my suggestions:

  • submit
  • produce
  • serve

I don't have a clear preference among these three (although I'm not so sure about submit). I selected these words because they have the connotation of returning a value, at least in my opinion.

@JanSharp
Copy link
Owner Author

JanSharp commented Nov 24, 2021

Yea no, result will definitely not be it.

Agreed on leave and exit, that's why I also don't like them.

submit is a bit similar to result imo where in normal code it already has common meaning, mostly as a submit button. It's better than leave for sure, but still problematic.
Unfortunately serve is problematic due to politics (or whichever the right term for it is). "recently" git moved the default branch name from "master" to "main" (decided by the community) due to the "master" "slave" terminology. "serve" can very easily be put in the same boat, so I'd rather stay away from that.

I like produce. I see very few issues with that.

With all that said, thanks a lot for the input, and my current candidates are

  • break - simple and sweet
  • produce - describes the concept of resulting in values
  • retreat - incredibly similar to return but still different

There are downsides and upsides to all of those, so I'm still not sure. Definitely better than my initial thoughts though

@curiosity-a
Copy link

break depends a lot on if you are going to introduce the classical break functionality and how. It may clash with that. And there is always the connotation of that functionality.

retreat I saw on Discord, but didn't like it. Did't sound fitting. I think it's because it implies moving away, not from one thing to another. Speaking of which, new series of candidates:

  • transfer
  • pass
  • convey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants