Do we really need const?

0ffh spam at frankhirsch.net
Mon Sep 17 14:50:00 PDT 2007


Robert Fraser wrote:
 > Bruce Adams Wrote:
 >> The problem with this is it isn't easy to tell how many problems would
 >> have been prevented if you are a regular user of const because they've
 >> been prevented. [...]
 > I think this is a similar argument to the one used to argue that static
 > typing prevents a lot of bugs that dynamic typing might introduce. [...]

As an aside, I think that people tend to use one bin for dynamic typing
and the auto-instatiation of variables that many dynamically typed
languages use (and which is, of course, very evil :-).

 > The potential for a bug doesn't mean that that potential will be used,
 > and the productivity benefits of NOT having const might be greater.

It might at least make things simpler, which is a gain in itself.
The question is if this outweighs the advantages of having const.
Maybe it really *is* time to deconstruct the christmas tree and
have a look what kinds of constness are important enough to justify
complicating the language by narrowing code freedom.

Regards, frank




More information about the Digitalmars-d mailing list