Hacker News new | ask | show | jobs
by always_good 3324 days ago
That's a misnomer, not a misgiving.

val/var/const/whatever only describe the reference, not the value. It doesn't really make sense for that annotation to, say, swivel a collection between ImmutableList and MutableList.

Now, you might be right that it's confusing, this difference between reference mutability and value mutability. I see beginners struggle with it in Javascript's new let vs const all the time.

1 comments

Even with Object.freeze() it only prevents mutation of the top-level keys.