Rainer Deyke wrote:
On 10/26/2010 20:16, Walter Bright wrote:
Rainer Deyke wrote:
On the other hand, if the object itself calls it own public member
functions, then no invariants should be checked.  Not being able to call
public member functions while the object is temporarily in an invalid
state is too strict.  This is a problem that I actually ran into while
using D, and one of the reasons for why I stopped using invariants.
A solution is to redesign what the class considers public and private. A
public member can be a shell around a private implementation, and other
class members can call that private implementation without invoking the
invariant.

Writing wrapper functions is a waste of my time.  Auto-generating
wrapper functions through some sort of meta-programming magic is still a
waste of my time, since the process cannot be completely automated.

Then I agree that not using invariants at all is probably your best option.

Reply via email to