PhobosWatch: manifest => enum

Bill Baxter dnewsgroup at billbaxter.com
Sat Dec 29 15:14:32 PST 2007


Walter Bright wrote:
> 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.

Huh?  So the fix is to make constants not const?  Seems like the problem 
lies either in auto or in the expectation that const will not be 
transferred using auto.  I would actually expect there to be an 
unconst!(X) template required in there or something if it's going to 
strip off const.

--bb



More information about the Digitalmars-d mailing list