Flag proposal
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Sat Jun 11 04:44:25 PDT 2011
On 6/10/11 11:55 PM, Nick Sabalausky wrote:
>>> However, I still think it's a deterioration from the user's point of
>>> view compared to the current situation with hand-crafted enums: it still
>>> requires a string, and the documentation will say func(Flag!"abc" abc),
>>> repeating the parameter's name unless you hand-craft a special Ddoc
>>> version of the function declaration. It's better than Flag!"abc".yes,
>>> but it's worse than Abc.yes.
>>
>> But the problem is the same today.
>>
>> enum Abc : bool { no, yes }
>> void fun(Abc abc = Abc.no);
>>
>> No difference. In the function declaration, the word "abc" occurs three
>> times.
>>
>
> Which makes Flag even less of an improvement.
I'm not sure I figure the reasoning. You can't penalize twice for the
same reason. This makes the existing situation less desirable, not Flag
less of an improvement over it.
Andrei
More information about the Digitalmars-d
mailing list