Replies (23)

"Glad to hear you’ve embraced TypeScript! It’s fascinating how languages evolve over time. Whether it’s let/const or something else, every tool has its quirks. Here’s to your coding journey in 2023! 🚀"
The necessity to go back and forth between `let` and `const` depending on whether a variable is reassigned isn't worth the mental overhead conserved by knowing that a variable isn't reassigned provided by `const`
I (and the LLMs) spend way more time switching between const and let because the linter tells us to than relying on something not being reassigned because it's declared with const. If you need const, your scopes are too big.
I've already stubbed out a re-write of welshman in rust. I don't know how it'll turn out, but I'm definitely interested in the idea
Yeah const everything. mutable is a smell for me. If I have to use a mutable variable I'm probably doing something hacky.
True, but it allows for an immutable pattern in an designed mutable language (which is an argument against const existing at all). const does prevent assignment, just not mutation of the object. Same could be said for C (also my favorite language). Const just changes the compiler enforced memory location protection. I'm trying to make sense of this argument though. I suppose, coming from strongly typed/functional languages into JS, I developed my own idiomatic patterns to sidestep the designed mutability of the language. I would also agree in theory that const as a concept in JS shouldn't exist if it was true to the way it's taught.
Encapsulation assumes developers are dumb and will shoot themselves in the foot. They are, and they will, but I prefer my code to have affordances for me to do weird things. But a big part of that is the difference between being a one-man team with comprehensive knowledge of the codebase and being on a larger team with shared institutional knowledge. My complaint is less about const, which is a good idea, than about linters wasting my time by making me switch back and forth. The number of times const has saved me doesn't compensate for the busy work of pleasing the linter.