A recent tweet by @raganwald pushed me over the edge: I’ve switched from “const only for 100% immutable things” to “const whenever possible”
-
-
@rauschma@wagenet@raganwald using mut is abusing and diluting a useful, strong signal of intent: "this binding is immutable on purpose" -
omg that's so perfect. As opposed to "well this value never mutated so I guess my linter should force me to make it const"
End of conversation
New conversation -
-
-
Could also be the other way around — "let" indicates mutability (which is far less common at least in my code). Shows less of an intent 1/
-
but is imho not less useful. Admittedly however, wording of the keywords clearly promotes your approach. 2/2
-
Also note: function params are let not const. So you have to deal with that in a "const-first" mental model.
-
`const` looks useful and sophisticated, but is of little actual value.
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.