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);

When showing code don't purposefully make it verbose to strengthen your case. Here is how Flag is usually used:

  getLine(Yes.keepTerminator);

Which is way more readable. Named parameters are not needed!

Reply via email to