std.unittests for (final?) review
Michel Fortin
michel.fortin at michelf.com
Wed Jan 5 19:35:13 PST 2011
I'm not sold on the concept. The whole point of this module seems to
offer a way to replace the built-in assertion mechanism with a
customized one, with the sole purpose of giving better error messages.
So we're basically encouraging the use of:
assertPredicate!"a > b"(a, b, "message");
instead of:
assert(a > b, "message");
It looks like an uglification of the language to me.
I agree that getting better error messages is important (very important
in fact), but keeping the code clean is important too. If the built-in
assert doesn't give us good enough error messages, perhaps it's the
built-in assert that should be improved. The compiler could give the
values on both side of the operator to the assertion handler, which
would in turn print values and operator as part of the error message.
So to me this module is a temporary fix until the compiler is capable
of giving the necessary information to the assertion handler. I sure
hope it won't be needed for too long.
(Note: this criticism doesn't apply to those assertions dealing with
exceptions.)
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the Digitalmars-d
mailing list