News for hackers. Stuff that matters.
Re:Scala: the Case for Correctness by frowaway001 on Wednesday October 15, 2014 @12:13AM (#8457126)
> It's easy for a parser or a person to scan the local scope and see if a variable is ever possibly mutated or not.

"what the parser figured out" != "what the author intended"

> this is a straightforward syntactic property

Not for the reader.

Re:Scala: the Case for Correctness by StefanKarpinski on Wednesday October 15, 2014 @12:15AM (#8457132)
No, seriously, it's easy:

Is there exactly one assignment location that's not in a loop or a conditional?

yes => constant ; no => non-constant

This is neither hard nor unintuitive.

Re:Scala: the Case for Correctness by frowaway001 on Wednesday October 15, 2014 @12:26AM (#8457166)
So you are recommending to create a special case just for declarations in local scope?

So "var" in global places means "variable", but "var" in local places means "variable or value"?

Re:Scala: the Case for Correctness by StefanKarpinski on Wednesday October 15, 2014 @12:31AM (#8457179)
I'm not recommending anything. I'm wondering what the point of declaring something that's obvious from a simple syntactic analysis is. The author of this post makes a big deal of it and I don't see why it's useful. If the motivation is that constness is the right default in global scope and you want to make local and global scope more similar (even though they are still radically different), that's cool, but then don't make it out like local variables defaulting to const is the best thing ever invented.