On 2011-01-06 08:44:33 -0500, Lutger Blijdestijn
<lutger.blijdest...@gmail.com> said:
Michel Fortin wrote:
The whole point of my proposal is to make the regular asserts print a
message similar to yours *by default*, when you don't specify any
message. This is possible because assert is not a function, it's a
language construct handled by the compiler. The compiler has access to
the whole expression tree, and it can rewrite the code to store
intermediate results in variables it can later give to the assertion
handler in case of failure.
I understood, but was reacting to the proposition that assertPred is not an
improvement over the current situation, isn't that what you were saying?
Just being pragmatic, it's unlikely such big changes to assert are going to
land in dmd anytime soon. But if they are, yeah that would be cool.
assertPred is an improvement for error messages but it's not without a
price. Basically you trade the very straightforward assertion syntax
for a more verbose and less intuitive syntax. My argument is that this
is an unnecessary tradeoff since we can just "fix" assert instead.
I think the consensus is that 'assert' can and should give us better
error messages, but that assertPred is a good stopgap solution for most
cases.
--
Michel Fortin
michel.for...@michelf.com
http://michelf.com/