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

Moritz Maxeiner via Digitalmars-d digitalmars-d at puremagic.com
Wed Jun 28 07:33:52 PDT 2017


On Wednesday, 28 June 2017 at 14:09:40 UTC, Enamex wrote:
> On Wednesday, 28 June 2017 at 12:34:59 UTC, Moritz Maxeiner 
> wrote:
>> On Wednesday, 28 June 2017 at 12:17:36 UTC, Enamex wrote:
>>> R foo(Args...)(Args args) {
>>>     out(return > bar && ensured(return), "foo() fudged its 
>>> return");
>>
>> Contracts inside function bodies should not be allowed imho.
>
> I was going with the current 'Proposal' syntax in the DIP's 
> document. There a more recent proposal here?

The DIP is still at pre-preliminary review round 1 (since it 
hasn't finished yet).
The current syntax proposal is effectively emergent through H. S. 
Teoh's general proposal [1], Solomon E's out enhancement [2], and 
Timon Gehr's implementation of the former two [3].
You can see in Timon's examples [4] how it looks (and contracts 
are part of a function's signature).

[1] 
http://forum.dlang.org/post/mailman.3511.1497981037.31550.digitalmars-d@puremagic.com
[2] 
http://forum.dlang.org/post/xtimtynqeuzmgaychpdq@forum.dlang.org
[3] http://forum.dlang.org/post/oijl5f$20fv$1@digitalmars.com
[4] 
https://github.com/dlang/dmd/compare/master...tgehr:contract-syntax#diff-0630cf91becfdb077688ebd1ef400c5a


More information about the Digitalmars-d mailing list