Const system names

Simen kjaeraas simen.kjaras at gmail.com
Tue Feb 16 10:51:29 PST 2010


bearophile <bearophileHUGS at lycos.com> wrote:

> Alternative names for the transitive const regime of D2, the main  
> difference is that now immutable values are the default:
>
> - "immutable" ==> (nothing, it's the default).
> - "const" ==> "valview" (a local immutable value view of something).
> - mutable variable ==> "var"
> - "enum" ==> "const" (or maybe it can be removed, so it becomes  
> immutable, that is no annotation. The link-time optimization of LDC is  
> able to remove unused values from the binary. Ten years from now all D  
> compilers can be able to do this).

I like the idea, and would like to try D with a system like this.
However, I disagree with the names. See, with my beautiful collection
of bike shed colors, I would keep 'const' for 'const' (for backward-
compatibility and familiarity, and I think valview is an abomination),
and use 'alias' instead of 'enum' (which I still consider the most
glaring error in the history of D).

For transition purposes, 'immutable' could of course be a no-op.

-- 
Simen



More information about the Digitalmars-d mailing list