PhobosWatch: manifest => enum

Sean Kelly sean at f4.ca
Sun Dec 30 16:18:19 PST 2007


Walter Bright wrote:
> Sean Kelly wrote:
>> err... make that unnamed and named.  One could argue that support for 
>> unnamed enums is simply for ease of porting from C rather than because 
>> it's a feature that really makes sense in a new language.  So making 
>> it even more entrenched is undesirable.  But we need the feature and 
>> if "enum" is it then...
> 
> Right. Anonymous enums are already conventionally used not to declare 
> enums, but a bunch of (not necessarily related) manifest constants. In 
> fact, in C++ we see:
> 
> template<> class factorial<1>
> {
>   public:
>     enum { result = 1 };
> };
> 
> where anonymous enums are clearly used to declare manifest constants.

Yup.  I simply find it troublesome that /conventions/ in C/C++ are being 
used as justification for new language features in D.  For programmers 
new to D who do not have a C/C++ background, I'm not sure I'd want to 
resort to a history lesson when asked why 'enum', which is short for 
'enumeration' is used to signify manifest constants.


Sean



More information about the Digitalmars-d mailing list