Manifest constants (was const again)

Bill Baxter dnewsgroup at billbaxter.com
Sat Dec 8 15:30:02 PST 2007


Derek Parnell wrote:
> On Sat, 08 Dec 2007 11:16:27 -0800, Walter Bright wrote:
> 
>> Derek Parnell wrote:
>>> On Sat, 08 Dec 2007 01:01:27 -0800, Walter Bright wrote:
>>>
>>>> With the enum case, I doubt it would take more than a moment for someone 
>>>> to figure out what it was, and it is not confusingly similar to 
>>>> something else. Once one knows what it is, one might take a moment to 
>>>> ridicule the choice of keyword, but that's about it before getting past 
>>>> it and it becoming just more D jargon like static, class, and real.
>>> True and sad. Another opportunity to "do the right thing" missed.
>> C'mon, it's not that big a deal!
> 
> One can tell that from the reaction, no? As your suggestion has generated
> almost zero comment then it must be a small deal. 
> 
> In any case, the point is not so much how you see the size of the deal, but
> how your customer's do. My reading of the situation so far is that it
> struck instant and vocal opposition. The group of people in support have
> been quiet in comparison. 

Naysayers are always the more vocal group.  People who agree with the 
status quo and those who just don't care aren't likely to post on the topic.

> Also, I feel it is especially significant that
> many of the people who have suggested that 'enum' is a poorer choice are
> not from the "usual suspects" set.
> 
>>> WILL THE NEW ENUM BE ALLOWED TO GROUP MANIFEST CONSTANTS TOGETHER?
>> No.
> 
> I take it that you are not so enamored with the school of thought that
> believes compilers exist to make life easier for coders. This keeps coming
> through in the mixed messages. You seem to want D to be an improvement over
> the foibles of C/C++ yet you have introduced a few constructs that are
> their own new foibles.
> 
> This one for example, means that redundant code will be needed and it has
> the potential to make reading source more difficult that it needs to be.

Redundant code?  You mean having to repeat those 4 letters e-n-u-m for 
each line?

Anyway the strange thing to me is that this seems to work in D2:

const {
     int x1 = 10;
     float x2 = "hithere";
}

Taking the address of x1 or x2 generates an error.
So making it not work for enum will require Walter to disable some 
functionality that currently exists.  Which is odd because I thought the 
only change was going to be the name.

--bb



More information about the Digitalmars-d mailing list