const

Georg Wrede georg at nospam.org
Thu Mar 27 16:23:49 PDT 2008


Sean Kelly wrote:
> == Quote from Walter Bright (newshound1 at digitalmars.com)'s article
> 
>>Sean Kelly wrote:
>>
>>>My only remaining issue with
>>>const is simply the choice of keywords for each meaning, and specifically,
>>>that the meaning of "const" not only changed from 1.0 to 2.0, but actually
>>>weakened.
>>
>>Every time we tried to address that, we wound up with a system that
>>didn't work.
> 
> I'm not sure I understand.  What I meant was that I didn't agree with the choice
> of keywords for const behavior in D 2.0--I have no major issue with the
> functionality itself.  In particular, I don't like that "const" in D 1.0 means "will
> never change" but in D 2.0 "const" means "read-only view" while an entirely
> new keyword was chosen for "will never change."  Thus the meaning of "const"
> is different from D 1.0 to D 2.0, and not only is it different, but the meaning
> is weaker.  This means that 1.0 code will compile just fine in 2.0 but can't rely
> on the same guarantees as 1.0 code can, which complicates maintenance if the
> code is intended to be cross-compatible.  I'm sure this won't bother me so much
> once D 1.0 is a distant memory, but in the interim it's somewhat painful.  That's
> all :-)

It's also an undue burden for any programmer who codes in both 1&2.

And that tends (in my humble experience) cause a lot of bugs, which at 
least the programmer himself has a very hard time noticing. And few of 
us have another D1-only or D2-only colleague who'd spot them.

( There ought to be a web site with anti-patterns for language 
development: semantics, syntax, homonyms, almost-alike-when-not and 
unlike-when-actually-same structures, elements, and names. And 
obfuscation of true meaning, origin and structure through cavalier 
sprinkling of syntactic sugar. )

More seriously, having to teach the particular language (be it 
high-school or university), gives one plenty more insight into this than 
I can even begin to say.



More information about the Digitalmars-d mailing list