PhobosWatch: manifest => enum

Walter Bright newshound1 at digitalmars.com
Fri Dec 28 17:08:36 PST 2007


James Dennett wrote:
> Walter Bright wrote:
>> Not really, just loosened up the restrictions on enum. The
>> implementation code is actually simpler <g>.
> 
> Surely you don't want to make a language that's less clear
> and/or pleasant for its users, because it's slightly easier
> to implement!

No, but a simple, clean implementation can be an indication of a simple, 
clean design. If the implementation is larded up with special case code, 
that's a flag that perhaps the users also see that lard.


>>> the only question is what syntax to use: either
>>> a counter-intuitive extension to enums or a new keyword (or a minor
>>> extension to the alias keyword as was suggested by somebody).
>> I found the "use an alias when declaring one constant" and "use an enum
>> when declaring more than one constant" to be difficult to justify. It's
>> like saying arrays with only one element should not be allowed.
> 
> But I thought from discussion that enum wasn't allowed to be used
> when declaring multiple manifest constants -- a rule more akin to
> saying that in some contexts it's legal to define arrays so long
> as they have exactly one element.

enum { X = 3, Y = 3L }

defines two manifest constants.



More information about the Digitalmars-d mailing list