Lazy mixins

Frustrated Who at where.com
Wed Mar 26 12:16:47 PDT 2014


On Wednesday, 26 March 2014 at 04:05:10 UTC, Philippe Sigaud
wrote:
>> No, I think I mentioned that string mixins can't get the 
>> context they are
>> inserted in. Why would I simply wrap a string mixin around a 
>> template mixin
>> if there wasn't some purpose that string mixins couldn't use 
>> in the first
>> place?
>
> OK. I just preferred to ask, to be sure.
>
>> Hence you can't do both. Use string mixins and you got to 
>> supply the
>> argument. Use template mixins and you can't overload 
>> properly(which makes it
>> useless in my case). If one could evaluate the string mixin 
>> after the
>> template mixin then it would all work. (and yes, it is the 
>> solution I want
>> unless you can actually come up with something that solves the 
>> problem
>> directly(both overloads properly and allows one to get the 
>> context)
>>
>> One can't do something like
>>
>> template B(T = typeof(this))
>> {
>>
>> }
>
> Did you try using a this template parameter?

doesn't work. You can't use this in string mixins. There is no
context.


More information about the Digitalmars-d mailing list