PhobosWatch: manifest => enum

James Dennett jdennett at acm.org
Fri Dec 28 14:13:50 PST 2007


Walter Bright wrote:
> Jérôme M. Berger wrote:
>> Walter Bright wrote:
>>> Jérôme M. Berger wrote:
>>>>     :(
>>> Yeah, I figure I'll get fricasseed over that one. The most compelling
>>> argument is that we already have 3 ways to declare a constant, adding a
>>> fourth gets very difficult to justify. As opposed to a minor extension
>>> to enums.
>>
>>     This is an artificial distinction: you *are* adding a fourth way to
>> declare a constant,
> 
> 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!

>> 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.

-- James



More information about the Digitalmars-d mailing list