DIP 1009--Improve Contract Usability--Preliminary Review Round 2 Begins

Nick Treleaven via Digitalmars-d digitalmars-d at puremagic.com
Mon Jul 31 02:55:22 PDT 2017


On Friday, 28 July 2017 at 16:44:24 UTC, MysticZach wrote:
> On Friday, 28 July 2017 at 11:04:23 UTC, Nick Treleaven wrote:
>> One option to solve the out contract ambiguity and aid parsing 
>> by tools is to require 'do' after out contract expressions.

BTW `do` would only be required before the {} function body - 
further `in` and `out` clauses also can be used to disambiguate, 
see below.

> One of the main goals of this DIP is to eliminate the need for 
> `body/do` in the common case. It would significantly reduce 
> this DIP's value if it couldn't do that, IMO.

This is subjective. If you put `do` on the end of the line, it is 
trivial:

in(x > 4)
out(works)
out(r; r.test)
out(flag) do
{
   // body
}


More information about the Digitalmars-d mailing list