Use let to declare variables?
I was just wondering if the reason to use var is to be more familiar to Javascript developers? Because JS developers are totally fine with let nowadays is used more than var and that way it also stays closer to rust syntax.
let is also permitted as an alias of var, as of a few days ago. In the future, it may gain immutability semantics, so I recommend not writing a lot of code with it. Generally, I'd advise using var where mutability is desired and let where it is not.
Wouldn't const be preferable over let for this?
I prefer constants that are explicit. Because of Rust and JavaScript, let will forever seem like a variable keyword to me.
const has different semantics. const values are intended to be possible to evaluate at compile-time. Examples of this would be type expressions, which need to be evaluated at compile-time for layout information to be calculated.
Agree with the different semantics of const. The way JS uses this keyword is broken in my opinion, being able to declare an object with const and still modify its properties feels super wrong.
Kotlin use of var for things that change and val for immutable values makes sense, could be same here but instead of val use let which makes it feel closer to rust
That's roughly what I'm going for, although the systems to get that working aren't (yet) in place.
Okay, now that I actually understand what you meant I totally agree with the concept. I'm not perfectly happy with the syntax but I can't think of anything better.