On Saturday, 15 March 2014 at 14:46:13 UTC, Daniel Murphy wrote:
"Andrej Mitrovic" wrote in message news:[email protected]...

How about a compromise based on Andrei's new final(bool) suggestion?
We could implement const(false) to allow overriding the default
behavior of invariants. E.g.:

class C
{
   invariant()  // const-by-default, as usual
   {
   }

   invariant() const(false) // new feature
   {
   }
}

That way existing code stays safe.

Yuck. We can always warn for a while on invariants not explicitly marked as const, if we're worried about breakage.

You should be able to use most of the language without using const, making invariants implicitly const was a bad idea.

I agree. Implicit const was only in play for a few releases; a couple of releases of deprecation time should be plenty, especially considering the number of users who have been unable to use invariants in those releases.

Reply via email to