named parameters to functions

David Brown dlang at davidb.org
Fri Oct 12 07:46:22 PDT 2007


On Fri, Oct 12, 2007 at 04:39:25PM +0200, Don Clugston wrote:
> Zola wrote:
>> Hi,
>> I'm amazed by some things D does have,
>> Except I'm puzzled by this one one gaping hole in D.
>> It's something I've been pissed off about C++ for 10 years now:
>> Named parameters to functions.
>> window* w = new_window("alert box", movable=false);
>
>
> My suspicion is that this would make name lookup really horrible.
>
> What does this code do?
> --
> bool movable;
> window* w = new_window("alert box", movable=false);

It would be better to implement using syntax that doesn't conflict with
other parts of the grammar.  Perhaps:

   window* w = new_window ("alert box", movable: false);

Dave



More information about the Digitalmars-d mailing list