Pretty please: Named arguments

Adam Ruppe destructionator at gmail.com
Mon Feb 28 12:44:14 PST 2011


Steven Schveighoffer:
> But other than that, it still looks more verbose than should be
> necessary.

This is the real problem.

We already have named arguments in today's D. You can do some stringof
magic to get the parameter names and ParameterTypeTuple to assign them.

I haven't written it, but there should be no blocker in combining these:

void foo(int width, int height);

auto args = NamedParameterTypeTuple!(foo);

args.width = 10;
args.height = 20;

foo(args);


But, that's just like the struct for length of code...


If someone wanted to write the code to add the foo(width:10, height:10), I
wouldn't likely object to it's inclusion. But, I
don't see it as a big deal.


More information about the Digitalmars-d mailing list