const=readonly invariant=const

Oskar Linde oskar.lindeREM at OVEgmail.com
Fri Jan 4 08:42:22 PST 2008


Bruce Adams wrote:
> On Wed, 02 Jan 2008 14:25:59 -0000, Daniel919 <Daniel919 at web.de> wrote:
>>
>>
>> My opinion
>>
>> is that const reads like: this will never change
>> I know there is no difference between 
>> const,invariant,readonly,immutable,... in the English language.
>> And that in C++ const also doesn't mean "this will never change".
>>
> My initial thought is oh no not again. It would be more productive to
> leave thoughts about syntax to one side until the semantics are thoroughly
> clear to everyone.

I fully agree. The actual keywords are secondary to the semantics (of 
course), but in this case, I think we may experience something similar 
to the Stroop effect in psychology. Imagine trying to explain the colors 
of a painting to someone, but insisting on using the word "red" to mean 
blue and "blue" to mean red.

Of all the "synonyms" above, "constant" is the one understood by most 
people. Unfortunately, the D keyword "const" doesn't mean constant -- it 
means something different and another keyword means constant. This fact 
can't be very helpful in making the semantics thoroughly clear to 
everyone. :)

-- 
Oskar



More information about the Digitalmars-d mailing list