Poll: Would you like to try const-by-default or not?

Daniel Keep daniel.keep.lists at gmail.com
Tue Jun 12 18:09:22 PDT 2007


I want to see option #2, but I think more work needs to be done to
ensure that all the problems related to metaprogramming get resolved.
For instance, this has me worried:

void foo(T)(T a)
{
  T b;
}

foo(new Object);

What's T?  If T is "const Object", then you've broken the "const by
default on function arguments only" stipulation.  If it's "Object" then
the inferred type is one thing, and *actual type* the compiler sees is
different.  It's not exactly very pretty.

There's probably other nasties lurking around, which is why I originally
proposed the addition of a const by default switch as a purely temporary
measure to see what happens.

That said, if we can't have the switch, I still think we should give
const by default a shot if only to see what the full impact is.  If it
turns out to be too onerous, then we can roll back to non const by default.

So yeah; +1 on option 2, provided we can sort out any issues that code up.

	-- Daniel



More information about the Digitalmars-d mailing list