Redundancies often reveal bugs

JimBob jim at bob.com
Fri Oct 1 03:50:51 PDT 2010


"Peter Alexander" <peter.alexander.au at gmail.com> wrote in message 
news:i843rl$1gr9$1 at digitalmars.com...
>> I dont know if it is, but IMO it really should be an error to declare 
>> local
>> variables that hide member variables.
>
> I disagree. I always do that in constructors:
>
> int x, y;
> this(int x, int y)
> {
>  this.x = x;
>  this.y = y;
> }
>
> I think you would annoy a lot of people if it was forbidden.

I'm sure it would. But i think the benefit would outweigh the cost. I mean 
the cost is coding style, personal preference, the benefit is fewer bugs.

And people would get used to it. 




More information about the Digitalmars-d mailing list