Named parameters

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Sat Jul 25 02:41:09 PDT 2015


On 2015-07-24 23:04, Walter Bright wrote:

> The question is what problem does it solve.

For one thing, it avoids the ugly hack which is the Flag template and 
Yes/No structs.

With Flag:

string getLine(Flag!"keepTerminator" keepTerminator);
getLine(Flag!"keepTerminator".yes);

With named parameters:

string getLine(bool keepTerminator);
getLine(keepTerminator: true);

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list