currently the language uses let and var. before the language was started, there was a very heated argument as for if to adopt the js const/let, the rust let/let mut, or the zig const/var, or another paradigm like val/var
i want to note the current semantics of let and var, because they are technically two very different things.
let x = y is an immutable reference to y. Transform doesnt actually emit any instructions for this besides the instructions for y. When x is used later, the instruction ref for y is inserted in place.
var x = y creates a .memory instruction that holds y as it's initial value. the .assign instruction is able to re-assign the memory location, and usages of x use the instruction ref of the memory. semantic analysis passes along the .memory and codegen will give it a js variable declaration
it should also be noted that runtime memory locations can only store runtime-supported types, such as int, and float. this means stuff like this is a warning:
// warn: not sure which type numeric literal `0` is
// add a type annotation, defaulting this to `float`
var count = 0;
var count: int = 0; // ok
Milestone: 0.3.0.
If #60 is implemwnted, the semantics of var are changed and my personal opinion of separating "let" and "var" would no longer apply as constant proportion would exist in both forms.
encouraging constant values over mutable ones via shorter syntax might be a smart choice.
Sorry to add another option but its possible to reduce the syntax by changing the operator
// const
a = 10
// mutable
b := 10
// alternatively "penalize" mutable (and make it more visible)
var b := 10
I personally find const/var to be the most verbally clear, but I agree it would be better to make const-things easier than mutable-things. Maybe the operator change can help with that
a = 10is ambiguous with reassignment
Sorry my original message was miseleading, I was assuming = would ONLY work with constants. E.g.
a = 10
var b := 10
b = 11 // error
b := 12 // no error
The thought being that = is kind of like a math equality, and := is assignment.