Do we need a time-out in D evolution?

Daniel Keep daniel.keep.lists at gmail.com
Sun Jun 10 02:06:38 PDT 2007



Walter Bright wrote:
> eao197 wrote:
>> A long time ago I had some expirience of modifying C++ code without
>> consts to code with consts. Main trouble was to identify methods which
>> must be declared as const -- it required full code review.
> 
> I suspect that it can be done by declaring all as const, then removing
> const from those that generate compile time errors. If you err on the
> side of adding too many const's, your program won't crash, it just won't
> compile.

Whoops.  I think you just gave the "const by default" camp a big crate
of those cool incendiary rounds.

I've been thinking about it, and I have to agree with both camps on a
lot of their arguments.  const by default is safer and clearer, whilst
mutable by default is obvious and more consistent with how we're already
writing code.

Since the new const stuff is going to require at least a few alpha
releases to get the kinks out, why not allow for both?  How hard would
it be to add a switch (say -constdefault) to the compiler *just* for the
initial alpha releases?  That way, instead of arguing over hypothetical
situations, we can actually sit down and work out the pros and cons of both.

An ideological fight to the death, if you will.  const by default in one
corner, mutable by default in the other, throw in some lightsabres and
let the problem sort itself out. :P

	-- Daniel



More information about the Digitalmars-d mailing list