digitalmars.D.bugs - [Issue 277] New: Named mixin operator resolution
- d-bugmail puremagic.com (39/39) Aug 03 2006 http://d.puremagic.com/issues/show_bug.cgi?id=277
- d-bugmail puremagic.com (19/19) Aug 13 2006 http://d.puremagic.com/issues/show_bug.cgi?id=277
- d-bugmail puremagic.com (11/11) Aug 15 2006 http://d.puremagic.com/issues/show_bug.cgi?id=277
- Bruno Medeiros (15/64) Aug 16 2006 Not sure if it will be an useful workaround but using "this" works:
- d-bugmail puremagic.com (9/9) Aug 16 2006 http://d.puremagic.com/issues/show_bug.cgi?id=277
- Bruno Medeiros (5/21) Aug 18 2006 Dude, don't reply in the bugzilla to posts made (solely) in the NG. :P
http://d.puremagic.com/issues/show_bug.cgi?id=277 Summary: Named mixin operator resolution Product: D Version: 0.163 Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: xergen hotmail.com template TestMixin(){ void opCall() { } void opCatAssign(uint val) { } } class Test{ mixin TestMixin bar; void foo(){ //bar(); // doesn't work !?!? bar.opCall(); // works //bar ~= 3; // doesn't work bar.opCatAssign(3); // works } } void main(char[][] args){ Test t = new Test(); t.bar ~= 3; // works t.bar(); // works t.bar.opCall(); // works t.foo(); } May seem trivial, but its actually pretty important for some friendly things im working on. Mixin operators can't be called from within the scope using the mixin? Odd :) Thanks. PS. You're my hero Walter. --
Aug 03 2006
http://d.puremagic.com/issues/show_bug.cgi?id=277 Also, operator selection doesnt happen with names. for example: template Foo() { void opAddAssign(int x) { } } class Bar { mixin Foo a; mixin Foo b; } Bar b; bar.a += 2; // ambiguouity error bar.a.opAddAssign(2); // works --
Aug 13 2006
http://d.puremagic.com/issues/show_bug.cgi?id=277 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement Priority|P2 |P4 This is not a bug because operator overloading needs an object, and a mixin is not an object. It's working as designed. I've changed this to an enhancement request. --
Aug 15 2006
d-bugmail puremagic.com wrote:http://d.puremagic.com/issues/show_bug.cgi?id=277 Summary: Named mixin operator resolution Product: D Version: 0.163 Platform: PC OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: xergen hotmail.com template TestMixin(){ void opCall() { } void opCatAssign(uint val) { } } class Test{ mixin TestMixin bar; void foo(){ //bar(); // doesn't work !?!? bar.opCall(); // works //bar ~= 3; // doesn't work bar.opCatAssign(3); // works } } void main(char[][] args){ Test t = new Test(); t.bar ~= 3; // works t.bar(); // works t.bar.opCall(); // works t.foo(); } May seem trivial, but its actually pretty important for some friendly things im working on. Mixin operators can't be called from within the scope using the mixin? Odd :) Thanks. PS. You're my hero Walter.Not sure if it will be an useful workaround but using "this" works: ---- class Test{ mixin TestMixin bar; void foo(){ this.bar(); // works bar.opCall(); this.bar ~= 3; // works bar.opCatAssign(3); } } -- Bruno Medeiros - MSc in CS/E student http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
Aug 16 2006
http://d.puremagic.com/issues/show_bug.cgi?id=277 thanks for the workaround Bruno, though I'm afraid that would still be subject to the problems with operator resolution in my comment :( Works great if you've only got one mixin however :) As far as it being an enhancement, I can see your judgement there. But I would still think the second issue is a bug, as it's simply ignoring the mixin name, which doesn't seem to make much sense to me. --
Aug 16 2006
d-bugmail puremagic.com wrote:http://d.puremagic.com/issues/show_bug.cgi?id=277 thanks for the workaround Bruno, though I'm afraid that would still be subject to the problems with operator resolution in my comment :( Works great if you've only got one mixin however :) As far as it being an enhancement, I can see your judgement there. But I would still think the second issue is a bug, as it's simply ignoring the mixin name, which doesn't seem to make much sense to me.Dude, don't reply in the bugzilla to posts made (solely) in the NG. :P -- Bruno Medeiros - MSc in CS/E student http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
Aug 18 2006