D const design rationale

Chris Nicholson-Sauls ibisbasenji at gmail.com
Mon Jun 25 20:54:34 PDT 2007


Walter Bright wrote:
> OF wrote:
>> Walter Bright Wrote:
>>
>>> BLS wrote:
>>>> I am afraid you will not like this idea, but not afraid enough. <g>
>>>>
>>>> Why not using a single keyword "const_" adding a number 1, 2, 3 to 
>>>> represent :
>>>> invariant, final, readonlyview.
>>>> the higher the number the higher (the stronger) the const.
>>>> means : const_3 == invariant;
>>>> At least a mental help, IMO; somehow borrowed from Modula 2 processes.
>>> You're right, I don't like the idea <g>.
>>
>> I'm curious. Was 'readonly'
> 
> readonly is a synonym for const, so no improvement there.
> 
> 
>> or 'readonlyview' considered as an alternative for 'const'? I kind of 
>> like the sound of 'readonly', and it doesn't make you think of C++ 
>> 'const'... but maybe that's bad.
> 
> readonlyview is too long.

But its only 3 characters longer than 'invariant'... ;)  Still, it is a 
little unwieldy aside from that.  I'm not too keen on keywords that are, 
linguistically, more than one word.  (I know, that sounds silly from one 
of the same people who begged for 'foreach' ages ago, but that's a 
keyword with enough history on it to be easily recognizable.  I might 
have preferred 'each' if it wasn't a common variable name.)

-- Chris Nicholson-Sauls



More information about the Digitalmars-d mailing list