On 2011-06-11 12:01:33 -0400, Andrei Alexandrescu <seewebsiteforem...@erdani.org> said:

On 6/11/11 10:40 AM, Michel Fortin wrote:
On 2011-06-11 09:56:28 -0400, Andrei Alexandrescu
<seewebsiteforem...@erdani.org> said:
For representing categorical data with small sets, programming
languages use enumerated types. This is because in a small set you can
actually give name each element. That way you have a separate type for
the categorical data so you can enjoy good type checking. The mistake
I believe you are making is the conflation of a categorical data with
two categories with an unstructured Boolean. By making that conflation
you lose the advantages of good typechecking in one fell swoop.

I think you're misinterpreting. I don't like yes/no enums because I
don't find the value names meaningful, but I'm perfectly fine with
two-element enums if they are properly named.

What is meaningless about OpenRight.yes?

Choosing between "yes" and "no" is not meaningful. I'd rather choose between "open" and "closed". Of course you'd have to pick a more fitting name for the enum, preferably one that could work for all bounds, not just the right one to make the category more useful.

--
Michel Fortin
michel.for...@michelf.com
http://michelf.com/

Reply via email to