Template currying

Yuxuan Shui via Digitalmars-d digitalmars-d at puremagic.com
Thu May 5 23:18:22 PDT 2016


On Thursday, 5 May 2016 at 23:33:07 UTC, Yuxuan Shui wrote:
> On Thursday, 5 May 2016 at 23:19:59 UTC, Yuxuan Shui wrote:
>> On Thursday, 5 May 2016 at 23:12:40 UTC, Ed wrote:
>>> On Thursday, 5 May 2016 at 22:53:01 UTC, Yuxuan Shui wrote:
>>>> [...]
>>>
>>> alias aa(T) = a!(1,T);
>>> aa!ubyte(2);
>>>
>>> Your alias declaration is not correct.
>>
>> As you can see in my first post, I know how to make this work. 
>> I just think it'd be nice if compiler can do this 
>> automatically.
>>
>> Anothor point is that, what if I want to use partially 
>> instantiated templates as template arguments?
>
> See this example:
>
>     int a(alias f)(){return f(3);}
>     int b(int z, T)(T c){return c;}
>     void main() {
>       a!(b!1)();
>     }
>
> It'd really nice if this just works, or if there's something 
> called Curry which I can use like this:
>
>     a!(Curry!(b, 1))

Wait, I just realized that this example works in 2.071, but not 
in 2.068.2. What has changed?



More information about the Digitalmars-d mailing list