Partial template application

bearophile bearophileHUGS at lycos.com
Mon Jan 31 12:25:31 PST 2011


Andrej Mitrovic:

> What I mean is, if curry detects that you're currying a compile-time
> argument against a template, then it should do what your
> PartialTemplate/StaticCurry would do.

This is currently not possible, a static curry needs compile-time arguments, so they need to specified as template arguments (with the bang !), while the normal curry is supposed to work with run-time values too.

Walter has tried to unify the two, using a syntax like:
void foo(int x, static int y, int z) {}
That's equivalent to:
void foo(int y)(int x, int z) {}

But the legend says he has found unspecified implementation difficulties, so the idea was abandoned. One purpose of D design is to avoid excessive compiler complexity.

-----------------------

Simen kjaeraas:

> dranges has something like this:
> http://svn.dsource.org/projects/dranges/trunk/dranges/docs/templates.html
> see CurryTemplate

Thank you for the link. This looks like a true currying, instead of a partial application like std.functional.curry.
I suggest to add CurryTemplate to Phobos2 while we wait forever for templates to be curried on default :-)

Bye,
bearophile


More information about the Digitalmars-d mailing list