Re:Constantly Confusing ‘const’
by evincarofautumn on Tuesday September 08, 2015 @05:05PM
(#10188204)
How do you mean? All this post is saying is that “const” in JavaScript is the same as “final” in Java—it lets you make immutable references, but not immutable objects. In C terms, you can express this:
But not this:
Even so, I don’t agree with the author’s argument that “const” is to be avoided. It does offer some protection against minor errors, which is not nothing.
[ Parent
| on HN ]
I don't think my argument was to avoid `const`. I think my argument was to pick `const` at the end rather than at the beginning. I feel those are different arguments.
Re:Constantly Confusing ‘const’
by evincarofautumn on Tuesday September 08, 2015 @10:13PM
(#10189302)
To be clear, “choose X last” does give the impression of “avoid X”, by which I don’t mean “don’t use X at all”. I disagree, but it’s a small matter; it’s not as if it would bother me to read your code.