digitalmars.D.bugs - [Issue 319] New: local variable can hide member variable
- d-bugmail puremagic.com (24/24) Sep 02 2006 http://d.puremagic.com/issues/show_bug.cgi?id=319
- d-bugmail puremagic.com (9/9) Sep 02 2006 http://d.puremagic.com/issues/show_bug.cgi?id=319
- Chris Nicholson-Sauls (16/44) Sep 02 2006 I'm sorry but.... why? One can easily disambiguate using the already pr...
- Bruno Medeiros (11/60) Sep 03 2006 I often end up using stuff like that in constructors:
- d-bugmail puremagic.com (11/11) Sep 03 2006 http://d.puremagic.com/issues/show_bug.cgi?id=319
http://d.puremagic.com/issues/show_bug.cgi?id=319 Summary: local variable can hide member variable Product: D Version: 0.165 Platform: PC OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: benoit tionex.de class C{ int mVal; public this(){ int mVal = 2; } public void func(){ int mVal = 2; } } This compiles. But I think using a local variable, hiding a member variable should be illegal. --
Sep 02 2006
http://d.puremagic.com/issues/show_bug.cgi?id=319 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement Priority|P2 |P3 This is an enhancement request. --
Sep 02 2006
d-bugmail puremagic.com wrote:http://d.puremagic.com/issues/show_bug.cgi?id=319 Summary: local variable can hide member variable Product: D Version: 0.165 Platform: PC OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: benoit tionex.de class C{ int mVal; public this(){ int mVal = 2; } public void func(){ int mVal = 2; } } This compiles. But I think using a local variable, hiding a member variable should be illegal.I'm sorry but.... why? One can easily disambiguate using the already provided 'this' referance, and there can be perfectly valid reasons to allow this (such as settors and obvious-use constructor parameters). A warning: maybe. An error: for the love of D, no! -- Chris Nicholson-Sauls
Sep 02 2006
Chris Nicholson-Sauls wrote:d-bugmail puremagic.com wrote:I often end up using stuff like that in constructors: class C { int x ; public this (int x) { this.x = x; } } -- Bruno Medeiros - MSc in CS/E student http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#Dhttp://d.puremagic.com/issues/show_bug.cgi?id=319 Summary: local variable can hide member variable Product: D Version: 0.165 Platform: PC OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: benoit tionex.de class C{ int mVal; public this(){ int mVal = 2; } public void func(){ int mVal = 2; } } This compiles. But I think using a local variable, hiding a member variable should be illegal.I'm sorry but.... why? One can easily disambiguate using the already provided 'this' referance, and there can be perfectly valid reasons to allow this (such as settors and obvious-use constructor parameters). A warning: maybe. An error: for the love of D, no! -- Chris Nicholson-Sauls
Sep 03 2006
http://d.puremagic.com/issues/show_bug.cgi?id=319 benoit tionex.de changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID Sorry, I thought it is comparable with the feature from dmd 0.161: "Shadowing local variable declarations is now deprecated." So I set the status to INVALID. --
Sep 03 2006