digitalmars.D.bugs - [Issue 9367] New: private in mixin template
- d-bugmail puremagic.com (60/60) Jan 22 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9367
http://d.puremagic.com/issues/show_bug.cgi?id=9367 Summary: private in mixin template Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: luka8088 owave.net Upgrading to D v2.061 broke my code so I investigated and found inconsistent behavior. The following example compiled in D v2.060: // main.d import foo; void main () { mixin m m1; } // foo.d module foo; private struct s { int i; } mixin template m () { s s1; } // foo.d(9): Error: module main foo.s is private So I am not sure if this is a bug or was it a bug before, and there is actually no any documentation for this specific case (that I could find). It only says "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." so it could be understood that mixin template can only see symbols from a scope that it is included in. On the other hand, if that is the expected behavior, then the following code should not compile (at least I think): // main.d import foo; void main () { mixin c.m m1; } // foo.d module foo; class b { private struct s { int i; } } class c { mixin template m () { b.s s1; } } Anyway, I think that the expected behavior in this cases should be better documented. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 22 2013