On Friday, October 12, 2012 11:31:36 monarch_dodra wrote: > Bask on subject, I _have_ started working with invariants. I > think they are nice, but there indeed some times where you'd wish > they wouldn't trigger. > > How about the @noinvariant function attribute? Sounds like a > simple enough solution. > > At that point, the developer can just insert "assert(&this);" in > said functions, if and where he judges it necessary.
That sounds like a decent solution to me, but I think that there's a good chance that Walter would reject it on principle (since in general, skipping the invariant pretty much defeats the purpose of having one). This is the only case that I'm aware of where it really makes sense to not have an invariant triggered, and he seems to be against the idea that opAssign wouldn't trigger the invariant when called, so I expect that he'd be against this as well if the whole purpose was to enable that case. Other, solid use case would probably be needed as well. - Jonathan M Davis
