PhobosWatch: manifest => enum

Steven Schveighoffer schveiguy at yahoo.com
Fri Dec 28 11:39:00 PST 2007


"Walter Bright" wrote
> Steven Schveighoffer wrote:
>>> As opposed to a minor extension to enums.
>>
>> Um... this is not minor :)  This is a complete redefinition of what enum 
>> means.
>
> enum is already used to declare arbitrary constants *that do not have an 
> enum type* in C, C++, and D.

The implementation does not follow the semantics.  An enum is still 
conceptually a group of related definitions that have the same type (i.e. 
enumeration).  You are proposing to redefine this as a group of unrelated 
definitions that can have different types.  Yes, people use enum to define 
constants in code, but they are usually all related, even though they don't 
have to be, and they are all of the same type because conceptually, *an 
enumeration is a collection of like-type values that can be assigned to a 
variable of the same type*.  I like the way this is enforced today.

This is going to confuse the hell out of all newcomers, and I think there 
are very few people who use D that actually think this is a good idea 
(myself included).  There are much better ways to solve this problem than 
destroying the traditional meaning of enum.

-Steve 





More information about the Digitalmars-d mailing list