assert(obj) is an atrocity

Andrej Mitrovic andrej.mitrovich at gmail.com
Sun Nov 13 10:43:05 PST 2011


On 11/13/11, Alex Rønne Petersen <xtzgzorex at gmail.com> wrote:
> I'd just like to add, regarding asserting invariants: Why not just *make
> invariants callable*? I.e. obj.invariant() invokes the invariant
> function.

I think you would have to wrap it as debug() { obj.invariant(); },
otherwise you would end up calling the invariant in release-mode.


More information about the Digitalmars-d mailing list