extreme curring (proposal)

Thorsten thorstenkiefer at gmx.de
Sat Mar 3 16:53:06 PST 2007


Hi, at the moment it is not possible, but it wold be nice to have in the future.
(But maybe not very necessary)

R delegate(U) Curry1(R,X...,U...)(R delegate(X,U) dg,X args)
{
	struct Foo
	{
		typeof(dg) dg_m;
		X args_m;
		
		R bar(U xs)
		{
			return dg_m(args_m,xs);
		}
	}
	
	Foo* f = new Foo;
	f.dg_m = dg;
	foreach (i, arg; args)
		f.args_m[i] = arg;
	
	return &f.bar;
}

I know that "double variadic template arguments" are not possible with the current version, right ?




More information about the Digitalmars-d mailing list