On 09/03/2011 03:12 PM, Martin Nowak wrote:
On Sat, 03 Sep 2011 11:50:25 +0200, Christophe
<[email protected]> wrote:

void main()
{
auto foo = (int x = 10){ /* */ }
void delegate() bar = { return foo(); }
}

the compiler could in theory just automatically insert a thunk like
this.

That sounds reasonable.

This look like a library solution would be best.
I suppose you want to store a homogeneous list of delegates.
Actually std.bind should do exactly this, but the module is broken and
needs a rewrite.

You should also be able to use std.functional's curry but it turns out
it's implementation
can't handle anything but two parameter functions.
I'll make a pull request for this one though. Then you should be able to
do 'alias curry!(foo, 10) bar'


http://d.puremagic.com/issues/show_bug.cgi?id=4391

Make sure to call the new implementation 'partial' or similar.


Reply via email to