Feature request: Optional, simplified syntax for simple contracts
TommiT
tommitissari at hotmail.com
Thu Jun 20 03:03:20 PDT 2013
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.
More information about the Digitalmars-d
mailing list