Flag proposal

Andrej Mitrovic andrej.mitrovich at gmail.com
Fri Jun 10 09:45:07 PDT 2011


I like how your proposal is already a pull request.

I'm not too fond of this workaround:

bool state;
getopt(
    args,
    "state",      &state,
);
auto line = getLine(cast(Flag!"KeepTerminator")state);

Will getopt know how to use Flags? What about std.conv.to?

std.format/write will have to know how to print out a Flag too, or we
have to cast:
writeln(cast(bool)keepTerminator);

If the plan is to replace all boolean arguments in Phobos with Flags,
won't this break a lot of code? We'll have to switch to using this
template, and then if we finally get named arguments sometime down the
road we will have to convert everything back to bools again.


More information about the Digitalmars-d mailing list