On 10/26/2010 07:25 PM, Walter Bright wrote:

An invariant that is not invariant is a meaningless attribute. It's like
"logical constness" where classes claim to be const but aren't.

an invariant which isn't used because it is too strict isn't much better.

Example:

class with some sort of state and public property function which grabs a bit out of some field or something

inside method, state violates invariant and I can't call this property function

I needed to use the property function, but I also needed the invariant so I shoehorned it into a regular function and explicitly made the calls. Ugly.

Though I suppose it was a slightly different case than what bearophile is proposing

Reply via email to