I agree, there's no point in requiring pureness, but this problem must be dealt with anyway. The user must never receive errors regarding invalid call of invariants.
On Tue, Oct 25, 2011 at 2:04 PM, Jonathan M Davis <jmdavisp...@gmx.com> wrote: > On Tuesday, October 25, 2011 05:38:37 bearophile wrote: >> Jonathan M Davis: >> > If you want it to be pure, you mark it with pure. It doesn't have to be, >> > and it's too restrictive to require that it always is - though >> > obviously it would ideally be pure. >> >> I think it should be pure, as in other languages that have DbC... Its purity >> helps static code analysis too, I think. > > Well, there's nothing stopping you from making your invariants pure, and in > general, it's probably good practice. But there's no reason to _require_ that > they be pure. Doing so would disallow potentially useful invariants for no > real benefit. Right now, you have the option of making the pure or impure, so > you get the best of both worlds. > > - Jonathan M Davis >