3 ms·
Nim also uses 'var' and 'let' for mutability. I like it as well.
by nazgulsenpai 4y ago
Nim also uses 'var' and 'let' for mutability. I like it as well.
- tekknik 4y agoknowing neither of these languages i’d rather it be labeled something more clear as neither one of those screams immutable to me. the immutable variant should use the ‘const’ keyword instead.
- KptMarchewa 4y agoI hope they won't use const. The meaning of it is extremely overloaded in C++.
- donarb 4y agoConst variables are traditionally initialized at compiled time. In Swift, let may be initialized at runtime and then becomes immutable.
- tekknik 4y agothat’s just a choice by the language designer. nothing prohibits initialization at runtime.
- ladberg 4y agoTo me `var` by definition means mutable and `let` sounds like you're laying out a constant in a proof, so I'd say both are pretty clear.
- tekknik 4y agothey both sound exactly the same to me, let sounding like an alias for var. also programs aren’t proofs so we certainly shouldn’t name keywords after them
- lifewallet_dev 4y agoWell Nim also has `const` the difference is that `const` must be evaluated in compile time, but `let` is just to prevent reassignments, more info: https://nim-lang.org/docs/tut1.html#constants https://nim-lang.org/docs/tut1.html#constants which is different than what JavaScript does.
- tekknik 4y ago3 people now saying the same thing. const is not required to be interpreted at compile time, these are choices made by language designers. and read the code with ‘let’ in it like it’s english, does let actually describe constnenss using its english definition? no. i’d argue that any language using ‘let’ for const values is borderline too theoretical. hell, even “define” is better than “let”