Temporary suspension of disbelief (invariant)
Walter Bright
newshound2 at digitalmars.com
Tue Oct 26 19:14:34 PDT 2010
Jonathan M Davis wrote:
> In the general case, it would overly complicate things to try and make an
> invariant not really be an invariant. If you really wanted to do that, you could
> use class variables which kept the state and made it so that the asserts in the
> invariant weren't run after a particular function call until another particular
> function call were made. But that strikes me as a colossally bad idea. Still, if
> you wanted such functionality, you _can_ get it, so I see no reason to
> complicate invariants just to make it easier to write what is likely bad code
> (or at least which is at a higher risk of being bad code).
Exactly. Having a class invariant that cheats is like painting over rust. It
might look new, but the rust will shortly break through.
More information about the Digitalmars-d
mailing list