Allow const or const let to be used within function scope #286
Closed
matiwinnetou
started this conversation in
Syntax suggestions
Replies: 1 comment 1 reply
|
All variables are already immutable. And shadowing is supported. const is just a way to define values at the module level. They don't even parse inside of function body expressions. I know Javascript has their differences between |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Having read https://aiken-lang.org/language-tour/variables-and-constants, initially I thought that it is possible to use
constin functions but unfortunately this is not the case. Very recently I had a case of the following method which using let of course works "fine"in this case it seems harmless but I would much prefer to get a compilation error on code like this:
or
I should not be able to change types and change values in the type of consts.
I personally don't like that we don't have support for const in function scope, in every programming language there should be a way to specify immutable local variables within function scope and hence in:
finalandfinal static[what current const does I guess]valPlease add support for const in functions or some new keyword, e.g. const let.
All reactions