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 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 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 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!

Re: how to declare an immutable class?

2016-08-11 Thread sldkf via Digitalmars-d-learn
On Thursday, 11 August 2016 at 17:56:59 UTC, Charles Hixson wrote: Does anyone know the correct approach? I do: °° immutable class Foo { this() {} } void main() { auto foo = new immutable(Foo); } °° But take care because you

Re: Template parameters that don't affect template type

2016-08-11 Thread sldkf via Digitalmars-d-learn
On Thursday, 11 August 2016 at 18:11:30 UTC, Engine Machine wrote: Is there any way to get D to understand I want do not want a template parameter to be part of the type comparison? No. Use a standard run-time parameter. Your problem can be solved by defining a constructor.