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

Moritz Maxeiner via Digitalmars-d digitalmars-d at puremagic.com
Sun Jun 25 05:01:41 PDT 2017


On Sunday, 25 June 2017 at 11:37:07 UTC, Andrei Alexandrescu 
wrote:
> On 6/23/17 6:52 PM, jmh530 wrote:
>> On Friday, 23 June 2017 at 17:31:15 UTC, MysticZach wrote:
>>>
>>> OutExpression:
>>>   out ( ; AssertParameters )
>>>   out ( Identifier ; AssertParameters )
>> 
>> Why not?
>> 
>> OutExpression:
>>    out ( AssertParameters )
>>    out ( Identifier ; AssertParameters )
>
> The path of least resistance is to use existing language 
> constructs, i.e.
>
> out result => assert(result > 0)

I consider adapting foreach syntax as using existing language 
constructs (instead of inventing completely new syntax).
And while your proposal may indeed be the path of least 
resistance (since you and Walter will end up deciding whether to 
accept it or not), it's also the path of least benefits as it 
still requires manually specifying the contract implementation. 
Coupling a contract with its implementation is verbose and can 
already be done with the existing syntax; imho it would ensure 
that the new syntax will receive only negligible more usage than 
the existing one.


More information about the Digitalmars-d mailing list