Re: mixin bug?

2016-08-12 Thread Engine Machine via Digitalmars-d-learn
On Friday, 12 August 2016 at 23:48:54 UTC, sldkf wrote: On Friday, 12 August 2016 at 23:14:23 UTC, Engine Machine wrote: On Friday, 12 August 2016 at 15:35:50 UTC, sldkf wrote: On Friday, 12 August 2016 at 02:09:21 UTC, Engine Machine wrote: On Thursday, 11 August 2016 at 21:25:20 UTC, sldkf

Re: mixin bug?

2016-08-12 Thread sldkf via Digitalmars-d-learn
On Friday, 12 August 2016 at 23:14:23 UTC, Engine Machine wrote: On Friday, 12 August 2016 at 15:35:50 UTC, sldkf wrote: On Friday, 12 August 2016 at 02:09:21 UTC, Engine Machine wrote: On Thursday, 11 August 2016 at 21:25:20 UTC, sldkf wrote: On Thursday, 11 August 2016 at 20:27:01 UTC,

Re: mixin bug?

2016-08-12 Thread Engine Machine via Digitalmars-d-learn
On Friday, 12 August 2016 at 15:35:50 UTC, sldkf wrote: On Friday, 12 August 2016 at 02:09:21 UTC, Engine Machine wrote: On Thursday, 11 August 2016 at 21:25:20 UTC, sldkf wrote: On Thursday, 11 August 2016 at 20:27:01 UTC, Engine Machine issue solved using a "template this parameter":

Re: mixin bug?

2016-08-12 Thread sldkf via Digitalmars-d-learn
On Friday, 12 August 2016 at 02:09:21 UTC, Engine Machine wrote: On Thursday, 11 August 2016 at 21:25:20 UTC, sldkf wrote: On Thursday, 11 August 2016 at 20:27:01 UTC, Engine Machine issue solved using a "template this parameter": °° template Cow() { void

Re: mixin bug?

2016-08-11 Thread Engine Machine via Digitalmars-d-learn
On Thursday, 11 August 2016 at 21:25:20 UTC, sldkf wrote: On Thursday, 11 August 2016 at 20:27:01 UTC, Engine Machine wrote: This requires F2 to know the future. It also forces it to use a specific bar. I want inheritance like logic. You are goind to hit a wall. Template programming is not

Re: mixin bug?

2016-08-11 Thread Engine Machine via Digitalmars-d-learn
On Thursday, 11 August 2016 at 21:03:36 UTC, Ali Çehreli wrote: On 08/11/2016 01:27 PM, Engine Machine wrote: > I see the mixin as a sort of copy and paste. That's the case for string mixins. Template mixins bring a name resolution scope. My understanding of the topic:

Re: mixin bug?

2016-08-11 Thread sldkf via Digitalmars-d-learn
On Thursday, 11 August 2016 at 20:27:01 UTC, Engine Machine wrote: This requires F2 to know the future. It also forces it to use a specific bar. I want inheritance like logic. You are goind to hit a wall. Template programming is not OOP. I'm not even sure that reflection would work in order to

Re: mixin bug?

2016-08-11 Thread Ali Çehreli via Digitalmars-d-learn
On 08/11/2016 01:27 PM, Engine Machine wrote: > I see the mixin as a sort of copy and paste. That's the case for string mixins. Template mixins bring a name resolution scope. My understanding of the topic: http://ddili.org/ders/d.en/mixin.html#ix_mixin.name%20space,%20mixin The spec:

Re: mixin bug?

2016-08-11 Thread Engine Machine via Digitalmars-d-learn
On Thursday, 11 August 2016 at 19:05:58 UTC, sldkf wrote: On Thursday, 11 August 2016 at 17:56:47 UTC, Engine Machine wrote: template F1(T) { void bar() { writeln("Bar0"); } } template F2(T) { mixin F1!T; void foo() { bar(); } } template F3(T) { mixin F2!T; void bar() {

Re: mixin bug?

2016-08-11 Thread sldkf via Digitalmars-d-learn
On Thursday, 11 August 2016 at 17:56:47 UTC, Engine Machine wrote: template F1(T) { void bar() { writeln("Bar0"); } } template F2(T) { mixin F1!T; void foo() { bar(); } } template F3(T) { mixin F2!T; void bar() { writeln("Bar1"); } // <- This bar should be used for F2's foo!

mixin bug?

2016-08-11 Thread Engine Machine via Digitalmars-d-learn
template F1(T) { void bar() { writeln("Bar0"); } } template F2(T) { mixin F1!T; void foo() { bar(); } } template F3(T) { mixin F2!T; void bar() { writeln("Bar1"); } // <- This bar should be used for F2's foo! } struct F4(T) { mixin F3!T; } (Or on can turn F3 in to a