Let's not make invariants const

Simen Kjaeraas simen.kjaras at gmail.com
Fri Aug 3 12:42:53 PDT 2012


On Fri, 03 Aug 2012 21:36:41 +0200, H. S. Teoh <hsteoh at quickfur.ath.cx>  
wrote:

> IMO, if you need to be changing stuff inside invariants, then you're
> using it wrong. Invariants are intended to verify program logic, not to
> do things like altering object state. The point is to be able to compile
> with invariant code turned off, and still have the program work exactly
> as before.

True. Then add in a (standard) library that's not const-correct, and you
have invariants that are outright unusable.

-- 
Simen


More information about the Digitalmars-d mailing list