invariant constancy: revisited
Daniel Murphy
yebbliesnospam at gmail.com
Sat Mar 15 07:46:28 PDT 2014
"Andrej Mitrovic" wrote in message
news:mailman.134.1394883267.23258.digitalmars-d at puremagic.com...
> 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.
More information about the Digitalmars-d
mailing list