digitalmars.D.bugs - [Issue 5297] New: The lookup order of recursive with statements is undefined.
- d-bugmail puremagic.com (31/31) Dec 01 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5297
- d-bugmail puremagic.com (17/17) Dec 01 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5297
- d-bugmail puremagic.com (27/29) Dec 01 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5297
- d-bugmail puremagic.com (8/13) Dec 01 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5297
- d-bugmail puremagic.com (12/12) Jan 20 2012 http://d.puremagic.com/issues/show_bug.cgi?id=5297
http://d.puremagic.com/issues/show_bug.cgi?id=5297 Summary: The lookup order of recursive with statements is undefined. Product: D Version: unspecified Platform: Other OS/Version: All Status: NEW Severity: trivial Priority: P2 Component: websites AssignedTo: nobody puremagic.com ReportedBy: blood.of.life gmail.com 05:27:29 PST --- In implementing SDC I find myself asking these questions, and I wish to try and put and end to DMD being the sole definer of semantics; just letting you know the reason for this and subsequent bug reports. Given a series of with statements: with (a) with (b) with (c) { d(); } If all three objects have a method d(), then c gets called. Obviously the with statements are considered in a LIFO order, and the sentence http://www.digitalmars.com/d/2.0/statement.html#WithStatement "Use of with object symbols that shadow local symbols with the same identifier are not allowed. " does not apply here. Neither is documented behaviour, and the only to figure out how D behaves is to run DMD. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 01 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5297 Simen Kjaeraas <simen.kjaras gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |accepts-invalid CC| |simen.kjaras gmail.com Component|websites |DMD Platform|Other |All Version|unspecified |D2 Severity|trivial |normal PST --- This is a compiler bug. Symbols used in with should shadow symbols from other with statements. You're right however, that the spec should state this. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 01 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5297 bearophile_hugs eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs eml.ccSymbols used in with should shadow symbols from other with statements.Do you mean "shouldn't"? This shadowing is not detected, and I think the compiler has to flag this is as a compile error (just like it does with normal variables in the function stack frame): struct X { int a; } struct Y { int a; } void main() { X x; Y y; with (x) { a = 2; with (y) { a = 1; } } assert(x.a == 2); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 01 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5297 PST ---Yes and no. It shouldn't silently do so, but it should detect that that is what is happening, and cry out loudly. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------Symbols used in with should shadow symbols from other with statements.Do you mean "shouldn't"?
Dec 01 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5297 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla digitalmars.com 11:29:23 PST --- The spec looks correct to me. The lookup order is not undefined, each successive with introduces a new scope which overrides previous scopes. As for the shadowing, that is a bug in the compiler. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 20 2012