Shadowing of members

Jonathan M Davis jmdavisProg at gmx.com
Wed Jan 9 14:25:35 PST 2013


On Wednesday, January 09, 2013 23:22:19 Andrej Mitrovic wrote:
> On 1/9/13, Walter Bright <newshound2 at digitalmars.com> wrote:
> > It is not a bug.
> 
> Something related I want to ask you about:
> 
> struct S
> {
> int _m;
> this(int m)
> {
> this._m = _m; // meant "this._m = m;"
> }
> }
> 
> I'd like to add a warning for identity assignments when it involves a
> parameter and a field of the aggregate which is the parent of the
> function. This was filed as
> http://d.puremagic.com/issues/show_bug.cgi?id=4407.

Why not just prevent identity assignments altogether? What would be the 
purpose of even allowing a variable to be assigned itself? I see no reason to 
single out parameters or member variables for that.

- Jonathan M Davis


More information about the Digitalmars-d mailing list