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

MysticZach via Digitalmars-d digitalmars-d at puremagic.com
Sun Jun 25 17:40:00 PDT 2017


On Sunday, 25 June 2017 at 12:10:02 UTC, Timon Gehr wrote:
>> The path of least resistance is to use existing language 
>> constructs, i.e.
>> 
>> out result => assert(result > 0)
>> 
>> 
>> Andrei
> This would face quite some resistance, on the following grounds:
>
> out(result){ assert(result > 0); } // exists
>
> out result => assert(result > 0) // more of the same
>
> out(result; result > 0) // better

I also imagine we'll end up seeing quite a lot of:

out( ; __result > 0)

...even though `__result` is still undocumented, because it's 
DRY. That's actually an incentive, IMO, to go ahead and document 
it. It's just tighter.


More information about the Digitalmars-d mailing list