super(...) in mixin template

John Colvin john.loughran.colvin at gmail.com
Wed Mar 5 01:53:57 PST 2014


On Wednesday, 5 March 2014 at 04:05:56 UTC, luminousone wrote:
> On Tuesday, 4 March 2014 at 12:04:12 UTC, John Colvin wrote:
>> On Tuesday, 4 March 2014 at 12:01:46 UTC, John Colvin wrote:
>>> On Tuesday, 4 March 2014 at 10:37:02 UTC, Steve Teale wrote:
>>>> On Tuesday, 4 March 2014 at 07:23:29 UTC, Jacob Carlborg 
>>>> wrote:
>>>>>
>>>>> Perhaps you already figured this out but template mixins 
>>>>> can only mixin declarations, not expression or statements.
>>>>>
>>>>> --
>>>>> /Jacob Carlborg
>>>>
>>>> Damn! Yup, first sentence of the documentation. Wishful 
>>>> reading.
>>>>
>>>> Thanks.
>>>> Steve
>>>
>>> You can of course mixin a function (either nested inside the 
>>> constructor or as a member or even a free funtion) containing 
>>> whatever you want and then call that.
>>>
>>> That won't help you with calling super() though, you can only 
>>> call super from another constructor. You'd have to use a 
>>> string mixin as that truly can inject arbitrary code.
>>
>> This opens a question:
>>
>> Should functions nested in constructors be given all the same 
>> powers that a constructor has (calling super, initializing 
>> const/immutable data etc)?
>
> http://d.puremagic.com/issues/show_bug.cgi?id=3332

I don't see how that's relevant? The crux of that request/bug is 
about overload resolution.


More information about the Digitalmars-d mailing list