DIP 1009--Improve Contract Usability--Preliminary Review Round 1
Mark via Digitalmars-d
digitalmars-d at puremagic.com
Sat Jun 24 14:40:26 PDT 2017
On Saturday, 24 June 2017 at 02:31:09 UTC, Solomon E wrote:
> I think my proposal to add another use of semicolon in
> parentheses, like `foreach` or `for` but not the same as
> either, was needlessly complicated.
>
> in (a)
> out (result) (a)
>
> as syntax sugar where each (a) lowers to
> {assert(a);}
> and in future can lower to something else, to renovate contract
> implementation
>
> That's so much easier, in every way.
Another option is to allow giving a name to a function's return
value in its signature, so something like:
int result myFunc(Args...)(Args args)
if (Args.length > 1)
in (args[0] > 0)
out (result > 10);
This is the approach taken by Dafny, which was mentioned earlier
in the thread. Can't say I like it.
More information about the Digitalmars-d
mailing list