Description
Currently, we have const
and var
for variable initializations.
const
means that the bytes directly referenced by the variable cannot change after this assignment.
var
means that they can.
Previously we had copied Rust and had let
and let mut
. See #34.
@procedural has suggested renaming const
to let
.
@thejoshwolfe says:
Where's the burden of proof here?
const
means it doesn't change, which matches the behavior of a const declaration. let is used in javascript and other languages for any kind of local variable
One argument for let
over const
is that it's the same length as var
and thus as easy to type. In general the language is supposed to guide the programmer into doing the Right Thing, which is to default to using const
/let
for as many things as possible instead of var
.
One argument for const
is that it matches the syntax of C, C++, and JavaScript.
In this issue, let's figure out How It Should Be and make a decision. Then once the decision is made we can refer people to this issue.