Immutability by default [was: Re: Tidy auto [Was: Re: @disable]]

Adam D. Ruppe destructionator at gmail.com
Tue Jan 19 11:12:40 PST 2010


On Tue, Jan 19, 2010 at 02:44:29PM -0300, Leandro Lucarella wrote:
> I don't understand, you are vulnerable to that kind of bugs now too:
> 
> const receiver = 1;
> 
> const reciever = 2; // meant to rebind, but spelling error goes unnoticed by compiler

Right, but it is more of a conscious effort to type const X = x; than it
is to type X := x;.

If you wanted to do immutable by default, wouldn't that means you get
yourself in the habit of typing := instead of =? That's not the same as
training yourself to type const (or immutable) where you would have typed
auto before.

Maybe I don't understand the proposal :S

-- 
Adam D. Ruppe
http://arsdnet.net



More information about the Digitalmars-d mailing list