Named arguments via struct initialization in functions

Chris Wright via Digitalmars-d digitalmars-d at puremagic.com
Tue Mar 8 10:46:02 PST 2016


On Tue, 08 Mar 2016 13:52:09 +0000, Martin Tschierschke wrote:
> What about this idea? A new word "as" or something similar.
> fun(ypos as y, xpos as x, radius as r); // different order!

The syntax isn't an issue.

There was one DIP about named parameters, but it was unpopular. It didn't 
change *anything* about overload resolution; it only had the compiler 
check that you provided arguments in the correct order, even if they were 
all of the same type.

Even if there were a DIP everyone liked, nobody is signing up to 
implement it. DDMD is a little scary and not reflective of good design in 
D (having been translated by machine from C++).

I might take a look, but I probably won't have the time to produce 
anything useful.


More information about the Digitalmars-d mailing list