DIP 1003: remove `body` as a keyword
Timon Gehr via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Mon Nov 21 12:59:32 PST 2016
On 21.11.2016 17:55, Piotrek wrote:
> On Saturday, 19 November 2016 at 21:16:15 UTC, Dicebot wrote:
>> DIP 1003 is merged to the queue and open for public informal feedback.
>>
>> PR: https://github.com/dlang/DIPs/pull/48
>> Initial merged document:
>> https://github.com/dlang/DIPs/blob/master/DIPs/DIP1003.md
>>
>> If you want the change to be approved and have ideas how to improve it
>> to better match on
>> https://github.com/dlang/DIPs/blob/master/GUIDELINES.md and existing
>> published reviews - please submit new PR with editorial and ping
>> original author.
>
> How about this alternative ("in" and "out" blocks inside function body):
>
> void foo(int a)
> {
> in
> {
> assert (a > 0);
> }
> out
> {
> (ret) assert(ret > 0);
> }
>
> // body code
>
> return a;
> }
>
>
> or for one-liners:
>
> void foo(int a)
> {
> in assert (a > 0);
> out (ret) assert(ret > 0);
>
> // body code
>
> return a;
> }
>
> BR,
> Piotrek
Won't work. Contracts are part of the function signature. That's the point.
More information about the Digitalmars-d-announce
mailing list