enum

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Apr 11 19:52:58 PDT 2014


On 4/11/14, 6:59 PM, Jonathan M Davis wrote:
> On Friday, April 11, 2014 17:01:15 Andrei Alexandrescu wrote:
>> On 4/11/14, 12:31 PM, Jonathan M Davis wrote:
>>> On Friday, April 11, 2014 08:22:01 Steven Schveighoffer wrote:
>>>> final enum name { ... }
>>>
>>> This only makes sense to me if it's then illegal to declare any variables
>>> of that enum type, because if you're looking to use an enum to give a
>>> list of possible values rather than enumerating the exact list of values,
>>> why would you be marking _any_ variable as being of that enum type?
>>
>> I don't understand that contention. "final" clarifies that the set of
>> values in the enumeration is closed.
>
> I take issue with the idea that it makes sense to have any variables of an
> enum type that isn't one of the values enumerated in the enum.

I explained the possible situations in the original post of this thread. 
E.g. one may be unable to enumerate all user IDs, but may be compelled 
to enumerate a few remarkable ones and ascribe user IDs a separate type. 
-- Andrei


More information about the Digitalmars-d mailing list