Skip to content

Consider a more descriptive keyword instead of "let" #289

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

Closed
stasm opened this issue Jun 28, 2022 · 7 comments
Closed

Consider a more descriptive keyword instead of "let" #289

stasm opened this issue Jun 28, 2022 · 7 comments
Labels
syntax Issues related with syntax or ABNF

Comments

@stasm
Copy link
Collaborator

stasm commented Jun 28, 2022

let is clear enough, but I think we have an opportunity to use a keyword that directly relates to the name that we choose for these let bindings (#248). This would be self-explanatory and easier to learn and search for. For example:

local $foo = {$count :number}   // ...and call them "locals"
alias $foo = {$count :number}   // ...and call them "aliases"
macro $foo = {$count :number}   // ...and call them "macros"
decl $foo = {$count :number}    // ...and call them "declarations"
expr $foo = {$count :number}    // ...and call them "named expressions"

Originally posted by @stasm in #287 (comment)

@stasm stasm added the syntax Issues related with syntax or ABNF label Jun 28, 2022
@stasm
Copy link
Collaborator Author

stasm commented Jun 28, 2022

This is related to #248. CC @mihnita @echeran @eemeli.

@stasm
Copy link
Collaborator Author

stasm commented Jun 28, 2022

Originally posted by @mihnita in #287 (comment)

I think let is fine, as it says "immutability" (if you come from JS, if not, then "tough luck")

From your list I also like macro and alias, as they are suggest "things you declare for convenience, something shorter, that you use to not repeat again and again something long"

The rest (decl and expr) are too generic.

And I think that macro and alias are more familiar than let, for a lot more people than JS devs.

@stasm
Copy link
Collaborator Author

stasm commented Jun 28, 2022

I think macro comes with its own baggage related to how macros are usually implemented through expansion during the compile time. It might be too prescriptive for our purpose.

Regardless of the name, do you think there's value in aligning the name with the keyword, e.g. locals defined with the local keyword? Or are you fine with, say, named expressions defined with the let keyword?

@eemeli
Copy link
Collaborator

eemeli commented Jun 29, 2022

One reason I rather like let is that it doesn't directly relate to the name of these bindings; another is that it's a complete, short word rather than an abbreviation. However, my opinions on this are not particularly strong, at least atm.

@echeran
Copy link
Collaborator

echeran commented Jun 29, 2022

To summarize, I prefer calling these things "named expressions", and using either let or expr sounds good to me. More details in #248, and +1 to @markusicu's comment there.

@mihnita
Copy link
Collaborator

mihnita commented Jun 30, 2022

Totally fine with let
In fact if you ask me to vote, I would probably vote let, alias, macro (in this order).

@stasm
Copy link
Collaborator Author

stasm commented Jul 18, 2022

It looks like there's enough support for continuing to use let that no changes need to be discussed for now.

@stasm stasm closed this as not planned Won't fix, can't repro, duplicate, stale Jul 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
syntax Issues related with syntax or ABNF
Projects
None yet
Development

No branches or pull requests

4 participants