PhobosWatch: manifest => enum
Bruno Medeiros
brunodomedeiros+spam at com.gmail
Sat Jan 5 07:54:08 PST 2008
Jérôme M. Berger wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> 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.
>
> Except that this is a different issue, on which I rambled at some
> length here:
> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=64262
>
> Basically, "auto" should drop the tail-most "const" if the language
> allows such types to exist and keep the "const" when it can't be
> dropped, e.g:
> - "const int" => "int";
> - "const (T*)" => "(const (T))*" (if such is allowed);
> - "const (MyClass)" => "const (MyClass)" (since the tailmost type
> is actually the hidden reference type).
>
> This should be done whether the right-hand expression is a manifest
> constant, a "const" variable or an "invariant" variable.
>
> Jerome
> - --
You mean head-most const (or just head const), not tail-most const.
--
Bruno Medeiros - MSc in CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
More information about the Digitalmars-d
mailing list