On 7/25/15 6:32 AM, Jonathan M Davis wrote:
On Saturday, 25 July 2015 at 09:41:19 UTC, 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);

With named parameters:

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

If Andrei weren't insisting that we use that idiom everywhere in Phobos,
I'd honestly just be using bools and be done with it. It adds some
value, but I seriously question that it's worth the extra verbosity. But
regardless, I'd hate to see named arguments get added to the language
just to clean that mess up.

Honest I didn't insist, and am a bit surprised that it did catch up. -- Andrei

Reply via email to