ExploreTrendingAnalytics
Nostr Archives
ExploreTrendingAnalytics
hodlbod5d ago
Sure, but the language's conventions are very reliant on reassignment. And const doesn't prevent mutation anyway. I say this as someone whose favorite language is clojure
💬 2 replies

Thread context

Root: 870a287751bc…

Replying to: b9168b83c859…

Replies (2)

ChipTuner5d ago
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.
0000 sats
ChipTuner5d ago
To your point https://git.vaughnnugent.com/cgit/vnuge/plugins-essential… Usually I would gate this functionality behind a branch to avoid reassigning a variable. It's very rare for me to use a mutable variable except in a very controlled scope. In some parts of this library I've wrapped with getters and setters.
0000 sats