digitalmars.D - Mixining templates having functions with the same name
- Victor Nakoryakov (33/33) Apr 02 2006 Hello,
- John Demme (25/63) Apr 02 2006 template T1()
- Victor Nakoryakov (33/34) Apr 03 2006 Ooops, forgot one line... following code doesn't compile:
- Bruno Medeiros (6/45) Apr 04 2006 Hum, seems like a bug to me, do fill a report:
- Victor Nakoryakov (10/14) Apr 07 2006 I think it isn't. The same error you get on attempt to use some
- Bruno Medeiros (8/22) Apr 08 2006 Yes, it seems like a similar error, yet I think mixins should allow for
Hello, Consider snipet: template T1() { void myproperty(real x) // line X { ... } } template T2() { real myproperty() // line Y { return ...; } } class C(alias M1, alias M2) { mixin M1!(); mixin M2!(); ... } ... auto c = new C!(T1, T2) ... Compilation of course gives an error: 'myproperty on line X conflicts with myproperty on line Y', this is expected dmd behaviour. But in this case I know what I do. So who know elegant solution do disambigue instanciation? -- Victor (aka nail) Nakoryakov nail-mail<at>mail<dot>ru Krasnoznamensk, Moscow, Russia
Apr 02 2006
Victor Nakoryakov wrote:Hello, Consider snipet: template T1() { void myproperty(real x) // line X { ... } } template T2() { real myproperty() // line Y { return ...; } } class C(alias M1, alias M2) { mixin M1!(); mixin M2!(); ... } ... auto c = new C!(T1, T2) ... Compilation of course gives an error: 'myproperty on line X conflicts with myproperty on line Y', this is expected dmd behaviour. But in this case I know what I do. So who know elegant solution do disambigue instanciation?template T1() { void myproperty(real x) // line X { } } template T2() { real myproperty() // line Y { return 5; } } class C(alias M1, alias M2) { mixin M1!(); mixin M2!(); } void main() { auto c = new C!(T1,T2); } The above code compiles, links, and runs fine with DMD 0.150 on Linux. ~John Demme
Apr 02 2006
John Demme wrote:The above code compiles, links, and runs fine with DMD 0.150 on Linux.Ooops, forgot one line... following code doesn't compile: template T1() { void myproperty(real x) // line X { } } template T2() { real myproperty() // line Y { return 5; } } class C(alias M1, alias M2) { mixin M1!(); mixin M2!(); } void main() { auto c = new C!(T1,T2); c.myproperty = 0; } dmd ../test ..\test.d(8): function test.C!(T1,T2).C.mixin M1!(); .myproperty conflicts with test.C!(T1,T2).C.mixin M2!(); .myproperty at ..\test.d(16) -- Victor (aka nail) Nakoryakov nail-mail<at>mail<dot>ru Krasnoznamensk, Moscow, Russia
Apr 03 2006
Victor Nakoryakov wrote:John Demme wrote:Hum, seems like a bug to me, do fill a report: http://d.puremagic.com/bugzilla -- Bruno Medeiros - CS/E student http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#DThe above code compiles, links, and runs fine with DMD 0.150 on Linux.Ooops, forgot one line... following code doesn't compile: template T1() { void myproperty(real x) // line X { } } template T2() { real myproperty() // line Y { return 5; } } class C(alias M1, alias M2) { mixin M1!(); mixin M2!(); } void main() { auto c = new C!(T1,T2); c.myproperty = 0; } dmd ../test ...\test.d(8): function test.C!(T1,T2).C.mixin M1!(); ..myproperty conflicts with test.C!(T1,T2).C.mixin M2!(); ..myproperty at ..\test.d(16)
Apr 04 2006
Sorry for delay, I'm totally forgot about my post :) Bruno Medeiros wrote:Hum, seems like a bug to me, do fill a report: http://d.puremagic.com/bugzillaI think it isn't. The same error you get on attempt to use some identifier that found in two modules that are imported. And this is expected behaviour described in docs. My case is the same situation, but I search a way to cheat the compiler. -- Victor (aka nail) Nakoryakov nail-mail<at>mail<dot>ru Krasnoznamensk, Moscow, Russia
Apr 07 2006
Victor Nakoryakov wrote:Sorry for delay, I'm totally forgot about my post :) Bruno Medeiros wrote:Yes, it seems like a similar error, yet I think mixins should allow for function overloading. I've submitted a bug report: http://d.puremagic.com/bugzilla/show_bug.cgi?id=96 Let's see how it turns out. -- Bruno Medeiros - CS/E student http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#DHum, seems like a bug to me, do fill a report: http://d.puremagic.com/bugzillaI think it isn't. The same error you get on attempt to use some identifier that found in two modules that are imported. And this is expected behaviour described in docs. My case is the same situation, but I search a way to cheat the compiler.
Apr 08 2006