Top 5

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Oct 11 08:01:16 PDT 2008


Oskar Linde wrote:
> Andrei Alexandrescu wrote:
>> Don wrote:
>>> Steven Schveighoffer wrote:
>>>> "Benji Smith" wrote
>>>>> And why do we need any special keyword?
>>> [...] The only reason we need manifest constants is because OPTLINK 
>>> isn't smart enough.
>>> (And DMD isn't smart enough to discard unreachable variables from the 
>>> symbol table).
> 
>> Exactly so.
> 
> That and the reason Walter mentioned: "There needs to be a way to 
> declare a constant of type int." (as opposed to const(int)), but I 
> disregard that statement as something symptomatic of a broken const-system.

That is a random statement to make unless backed up. The problem was:

auto x = CONSTANT;

People would expect to initialize x with a particular constant but then 
be able to use it. But auto for all types means give x whatever type 
CONSTANT has. If CONSTANT has const as part of its type, that will be 
transferred into x because that's what auto does, not because const is 
broken in any way, shape, or form.

> I've numerous times been trying to argue against the need for manifest 
> constants, but it has been about as useful as repeatedly banging your 
> head against a brick wall. And about as rewarding too.

Manifest constants do exist. Maybe you mean you want a different naming 
for them.

> It is good to finally hear that the sole reason we have them is 
> laziness. That makes acceptance much easier. :)

Well priorities are an issue too. Rewriting the linker would be a major 
effort. Walter would do it if really necessary.


Andrei



More information about the Digitalmars-d mailing list