digitalmars.D.bugs - [Issue 471] New: Protection attributes of mixin instances are applied in a wrong scope.
- d-bugmail puremagic.com (37/37) Oct 31 2006 http://d.puremagic.com/issues/show_bug.cgi?id=471
- Ary Manzana (4/48) Oct 31 2006 This is what I was talking about in the "Is a template like copy-paste"
- d-bugmail puremagic.com (9/9) Nov 25 2006 http://d.puremagic.com/issues/show_bug.cgi?id=471
http://d.puremagic.com/issues/show_bug.cgi?id=471 Summary: Protection attributes of mixin instances are applied in a wrong scope. Product: D Version: 0.173 Platform: PC OS/Version: Windows Status: NEW Keywords: rejects-valid, spec Severity: normal Priority: P4 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: brunodomedeiros+bugz gmail.com Protection attributes of mixin instances are applied in a wrong scope. The following illustrates it: ---- baz.d ---- module baz; template Baz() { private void privfunc(){ } } ---- ---- import baz; class Foo { mixin Baz!(); void testfunc() { privfunc(); // Error: .privfunc is private } } ---- ---- For reference the spec states (http://www.digitalmars.com/d/mixin.html): "Unlike a template instantiation, a template mixin's body is evaluated within the scope where the mixin appears, not where the template declaration is defined. It is analogous to cutting and pasting the body of the template into the location of the mixin." If the current compiler behavior is the intended behavior then fix the spec. --
Oct 31 2006
d-bugmail puremagic.com escribió:http://d.puremagic.com/issues/show_bug.cgi?id=471 Summary: Protection attributes of mixin instances are applied in a wrong scope. Product: D Version: 0.173 Platform: PC OS/Version: Windows Status: NEW Keywords: rejects-valid, spec Severity: normal Priority: P4 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: brunodomedeiros+bugz gmail.com Protection attributes of mixin instances are applied in a wrong scope. The following illustrates it: ---- baz.d ---- module baz; template Baz() { private void privfunc(){ } } ---- ---- import baz; class Foo { mixin Baz!(); void testfunc() { privfunc(); // Error: .privfunc is private } } ---- ---- For reference the spec states (http://www.digitalmars.com/d/mixin.html): "Unlike a template instantiation, a template mixin's body is evaluated within the scope where the mixin appears, not where the template declaration is defined. It is analogous to cutting and pasting the body of the template into the location of the mixin." If the current compiler behavior is the intended behavior then fix the spec.This is what I was talking about in the "Is a template like copy-paste" thread. Actually I was referring to copy-paste made by mixins. Are the specs wrong?
Oct 31 2006
http://d.puremagic.com/issues/show_bug.cgi?id=471 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED Fixed DMD 0.175 --
Nov 25 2006