Do we really need const?

Walter Bright newshound1 at digitalmars.com
Tue Sep 18 02:13:18 PDT 2007


Robert Fraser wrote:
> But as a purely interface thing, I
> think docs serve better.

The problem with docs is they are invariably wrong, out of date, 
ambiguous, or missing. Docs are also unreadable by analysis tools, and 
can't be relied upon by code auditors.


> Same with const, but top-down. Make something const in A, you have to
> make it const in B and C.

Only if B and C were done poorly to begin with, and didn't already say 
they didn't change the reference.

> If you ague that if B and C weren't
> changing it, then what if C's implementation changed in such a way as
> it dos make a change. Now, arrgh, got to go back and change it in B
> and A.

But that is a *relevant* change. The exception passthrough is not 
relevant, as it means nothing to B.



More information about the Digitalmars-d mailing list