Alex Rønne Petersen:

So what if, for whatever reason, the invariant needs to track and maintain some state in order to catch some kind of ugly bug?

This is legitimate practical need. I know two or more ways to solve that problem, one of them is to implement the prestate (old). That's probably the largest hole in the D implementation of contract programming, and I have felt its need several times.

Another solution (that doesn't replace the need for the prestate!) is ghost fields, that are class instance/struct fields usable only inside contracts and that vanish in release mode:
http://d.puremagic.com/issues/show_bug.cgi?id=5027

Bye,
bearophile

Reply via email to