DIP 1009--Improve Contract Usability--Preliminary Review Round 1

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Fri Jun 23 06:00:30 PDT 2017


On 6/23/17 5:06 AM, Solomon E wrote:
> What I expected from my impression of existing D syntax was that 
> something like this might be coming up:
> 
> T foo(T)(T x, T y)
>      in (x > 0, y > 0)
>      out (r; r > 0)
> {
>      return x % y + 1;
> }

The out contract looks pretty good actually. The in contract, not as 
good. That looks like a comma expression. I'd rather see this be:

      in(x > 0)
      in(y > 0)

or

      in(x > 0 && y > 0)

In this case, we have something I think I would support.

-Steve


More information about the Digitalmars-d mailing list