PhobosWatch: manifest => enum

Steven Schveighoffer schveiguy at yahoo.com
Sat Dec 29 11:01:22 PST 2007


"Walter Bright" wrote
> Don Clugston wrote:
>> You can abuse the facility to declare integral constants, but that's a 
>> secondary feature at best. The problem is that using enum for abtritrary 
>> types is a very poor match for the primary feature of enums.
>>
>> We don't want to create a type; we don't want a grouping; and the values 
>> are not integral.
>>
>> enum : int { A=2, B, C }
>>
>> Having an enum automatically get the 'next' value is one of the key 
>> feature of enums, and it relies on the base type being an enumerable 
>> type.
>
> The only thing it relies on is the ability to add 1 to the previous value. 
> The new enums can automatically get the next value for any type with this 
> characteristic, including UDT's that overload opAdd, as long as they can 
> be evaluated at compile time.

Correct me if I'm wrong, but isn't opAdd disallowed at compile time because 
it uses a this pointer?  Or are you changing that behavior for this feature?

-Steve 





More information about the Digitalmars-d mailing list