Flag proposal

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Jun 12 08:12:26 PDT 2011


On 6/12/11 7:26 AM, so wrote:
>>> My take on this is that we shouldn't try to reinvent the boolean in the
>>> standard library.
>>
>> I think this characterization is wrong. Let me replace the meaningless
>> Abc with an actual example, e.g. OpenRight in std.algorithm.
>>
>> OpenRight is not a Boolean. Its *representation* is Boolean. It is
>> categorical data with two categories. You can represent it with an
>> unstructured Boolean the same way you can represent an automaton state
>> with an unstructured integer or temperature with an unstructured
>> double, but then you'd have the disadvantages that dimensional
>> analysis libraries are solving.
>
> Quite contrary i think it is pretty much spot on, if it is not but just
> its representation is boolean so is every other usage of boolean.
>
> The only reason we use an enum instead of simple bool is self
> documentation "fun(OpenRight.yes)". You simply can't deny the named
> arguments solve not only this particular issue but the entire area
> nicely "fun(openRight:true, width:4, height:3, depth:5)".

Never did.

Andrei


More information about the Digitalmars-d mailing list