Mixin template parameters / mixin template literals

Timon Gehr timon.gehr at gmx.ch
Wed Apr 24 14:09:27 PDT 2013


On 04/24/2013 11:03 PM, Diggory wrote:
> On Wednesday, 24 April 2013 at 20:32:16 UTC, Timon Gehr wrote:
>> On 04/24/2013 07:07 PM, Diggory wrote:
>>> One way this could be done is by expanding on lazy parameters. Perhaps
>>> you could specify parameters for a lazy argument, so instead of always
>>> getting a delegate of type T delegate(), you could get one of type T
>>> delegate(U a, V b).
>>>
>>> For example, a parameter could be:
>>> void f(lazy bool exp(int a, int b)) {
>>>     bool result = exp(1, 2);
>>> }
>>>
>>> Then when you call that:
>>> f(a < b)
>>>
>>> The names 'a' and 'b' come from the parameter list for 'f'. I would
>>> definitely vote for this as a feature!
>>
>> This is a little dangerous as it looks like an ordinary expression but
>> has to somehow affect symbol scoping.
>
> Surely it's no more dangerous than lazy parameters already are. (they
> are already converted into a hidden delegate, it just happens to take no
> parameters at the moment)

It surely is. 'lazy' parameters do not affect symbol lookup in the 
passed expressions.


More information about the Digitalmars-d mailing list