On Tue, 13 Oct 2009 08:21:44 -0400, Jason House <jason.james.ho...@gmail.com> wrote:

Andrei Alexandrescu Wrote:

It's simpler actually:

debug void assert(T)( T expr, string delegate() msg ) {
     if(!expr)
         throw new Exception(msg);
}
else void assert(T)( T delegate(), string delegate() ) {
}

Hm, actually it's more complicated than your version :o).


Andrei



You should be throwing AssertError

I really like lazy for log messages and asserts. I like the implicit cast to (scope) pure delegate idea. It works well in those contexts.

With macros, this can be solved without lazy.

I'd say work on getting macros working, then drop lazy and assert.

-Steve

Reply via email to