On Wednesday, 19 June 2013 at 19:21:20 UTC, Marco Leise wrote:
I have implemented in CTFE, what I'd like asserts to look like:
http://dpaste.1azy.net/2ec082c0

It prints at runtime:

"x > y && x < 10" (x must be a digit and larger than y) failed with x: 2, y: 3
----------------
<stack trace>


When you write a contract like this:

void foo(uint x, uint y)
in { mixin(q{ x > y && x < 10 }.holds ("x must be a digit and larger than y")); }
body { … }



-- Marco

I think you should make a separate bugzilla enhancement request (or DIP. I don't know which one's more appropriate) for incorporating these better assert messages. It's a separate issue from contracts' syntax after all.

I like the fact that we wouldn't need any new (comma-separated-booleans) syntax for asserts then.

Reply via email to