Immutability by default [was: Re: Tidy auto [Was: Re: @disable]]
Leandro Lucarella
llucax at gmail.com
Tue Jan 19 15:16:00 PST 2010
Adam D. Ruppe, el 19 de enero a las 14:12 me escribiste:
> 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.
But := is a declaration, = is an expression! You will use := all over the
places for *declaring* stuff, not for assigning stuff.
> Maybe I don't understand the proposal :S
I think you understand the proposal, we just don't agree on how
error-prone it would be ;)
--
Leandro Lucarella (AKA luca) http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
Hey you, standing in the road
always doing what you're told,
Can you help me?
More information about the Digitalmars-d
mailing list