November 11, 2003
"Andrew Edwards" <edwardsac@spamfreeusa.com> wrote in message news:boph9f$2i54$1@digitaldaemon.com...
> Does anyone know of a good source for a detailed explanation of Set Theory and Element Argument?
>
> TIA
> Andrew
>
>

It would be a very good idea if D supported sets instead of enumerations. Example:

//integer enumeration
int set DAY = {
    SUN,
    MON,
    TUE,
    WED,
    THU,
    FRI,
    SAT
}

//string enumeration
string set DAY_NAME {
    MON_NAME = "MONDAY",
    ...
}

//bitfield enumeration
bit[3] set MODE = {
    ...
}

This has many advantages over enums:

1) it specifies how many bytes the enum occupies. This is very important,
especially if dealing with binary messages.
2) it can use complex types for enums.