AdvancedDelegate - "Partial application" for delegates and function pointers

Markus Dangl danglm at in.tum.de
Tue Jun 13 17:15:43 PDT 2006


IMPORTANT UPDATE:
I suddenly realised how helpful the auto keyword is, and i added a few 
helper functions to make things even more easier. You can now write:

auto add = AdvancedFunction(
	function int(int a, int b) { return a+b; }
);
writeln("add(2,2): ", add(2)(2).Eval);

The same goes for delegates, except i had to call the helper template 
"AdvancedDelegate". Seems i cant overload two templates like this:

AdvancedDelegate0!(R) AdvancedDelegate(R) (R delegate() dg)
{
     return new AdvancedDelegateP0G0!(R)(dg);
}

AdvancedDelegate0!(R) AdvancedDelegate(R) (R function() dg)
{
     return new AdvancedFunctionP0G0!(R)(dg);
}

But i don't think it is a big problem.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: advanceddelegate-1.0.zip
Type: application/octet-stream
Size: 11053 bytes
Desc: not available
Url : http://lists.puremagic.com/pipermail/digitalmars-d-announce/attachments/20060614/1ef5c5b3/attachment.obj 


More information about the Digitalmars-d-announce mailing list