Fully transitive const is not necessary

Walter Bright newshound1 at digitalmars.com
Wed Apr 2 18:16:05 PDT 2008


Bill Baxter wrote:
> On the other hand, const preventing you from calling some method you 
> shouldn't be calling (and thereby preventing a bug) doesn't leave much 
> of an impression.  You just go "duh -- of course I can't call that" and 
> move on.  Also bugs caused by data changing when you didn't expect it to 
> don't usually jump out as due to lack of const.  Instead you go "doh! I 
> shouldn't change that there" or "doh! I shouldn't call that function 
> here".  So unfortunately I think the value of const is very difficult to 
> judge using subjective measures.

Misuse of an API is a perennial problem (it has caused Microsoft endless 
grief trying to maintain backwards compatibility). Transitive const can 
help with that, as it makes it clear what is "no toucha my mustache!" 
and what is not.



More information about the Digitalmars-d mailing list