Named parameters

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Sat Jul 25 06:52:14 PDT 2015


On 7/25/15 5:41 AM, Jacob Carlborg wrote:
> 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);

Replace the second with:

getLine(Yes.keepTerminator);


Andrei


More information about the Digitalmars-d mailing list