4 ms·
Personally, I don't like these two kinds of syntax for declaring and assigning a mutable variable, because if code is moved around - which happens all the time
by prirun 4y ago
Personally, I don't like these two kinds of syntax for declaring and assigning a mutable variable, because if code is moved around - which happens all the time - I have to switch the syntax for declaration vs assignment. Same thing with Go's := and =.
- imtringued 4y agoThe vast majority of variables in your program won't be mutable or be changed around so why add the mental burden of mutability on every single variable just for some tiny minority of cases?
- izackp 4y agoIt doesn't have to be a mental burden.. Just write all your variables as mutable then let the ide automatically correct them to immutable. Ex: "Warning: This variable is never mutated. Would like to make it a const? <Fix>" Let's say it is a mental burden. I'd rather have the burden when writing the code over when reading the code. (https://news.ycombinator.com/item?id=31823991 https://news.ycombinator.com/item?id=31823991)