PhobosWatch: manifest => enum

Frank Benoit keinfarbton at googlemail.com
Sat Dec 29 15:29:55 PST 2007


Walter Bright schrieb:
> Jérôme M. Berger wrote:
>> Walter Bright wrote:
>>> Yes, that could be done, but we're still stymied by the problem that we
>>> are unable to declare a constant of type 'int', only 'const(int)'.
>>
>>     I don't see any situation in which we would need a constant of type
>> "int" instead of "const (int)" or "invariant (int)". After all, if
>> it is a *constant*, it should be either "const" or "invariant", no?
> 
> Consider the following:
> 
>     const int X = 3;
>     auto i = X;
>     i = 4;        // error, i is const
> 
> Essentially, it would make type inference far less useful.

Why is it neccessary to transfer the const for value types? The
assignment always makes a copy, so manipulation is OK?



More information about the Digitalmars-d mailing list