Thread overview | |||||
---|---|---|---|---|---|
|
October 31, 2006 [Issue 471] New: Protection attributes of mixin instances are applied in a wrong scope. | ||||
---|---|---|---|---|
| ||||
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. -- |
October 31, 2006 Re: [Issue 471] New: Protection attributes of mixin instances are applied in a wrong scope. | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | 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?
|
November 25, 2006 [Issue 471] Protection attributes of mixin instances are applied in a wrong scope. | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=471 bugzilla@digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #2 from bugzilla@digitalmars.com 2006-11-25 03:56 ------- Fixed DMD 0.175 -- |
Copyright © 1999-2021 by the D Language Foundation