D const design rationale
Leandro Lucarella
llucax at gmail.com
Fri Jun 22 07:26:32 PDT 2007
Walter Bright, el 22 de junio a las 01:07 me escribiste:
> Sean Kelly wrote:
> >Walter Bright wrote:
> >>http://www.digitalmars.com/d/const.html
> >So in short, 'const' protects data and 'final' freezes references. How do these two apply to an int declaration?
> > const final int x = 5;
> >Is either a compiler error? are they synonyms in this case?
>
> It's not an error, it's just redundant.
Shouldn't be better to be an error? So it's more clear that final makes
sense only for reference types.
Even more, aren't:
const int x = 5;
final int x = 5;
invariant int x = 5;
all the same?
--
LUCA - Leandro Lucarella - Usando Debian GNU/Linux Sid - GNU Generation
------------------------------------------------------------------------
E-Mail / JID: luca at lugmen.org.ar
GPG Fingerprint: D9E1 4545 0F4B 7928 E82C 375D 4B02 0FE0 B08B 4FB2
GPG Key: gpg --keyserver pks.lugmen.org.ar --recv-keys B08B4FB2
------------------------------------------------------------------------
No existe nada más intenso que un reloj, ni nada más flaco que una
bicicleta. No intenso como el café, ni flaco como escopeta.
-- Ricardo Vaporeso
More information about the Digitalmars-d
mailing list