Allow const or const let to be used within function scope #286
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 |
Beta Was this translation helpful? Give feedback.
-
Having read https://aiken-lang.org/language-tour/variables-and-constants, initially I thought that it is possible to use
const
in 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:
final
andfinal static
[what current const does I guess]val
Please add support for const in functions or some new keyword, e.g. const let.
Beta Was this translation helpful? Give feedback.
All reactions