DIP 1003: remove `body` as a keyword

Piotrek via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Mon Nov 21 13:29:14 PST 2016


On Monday, 21 November 2016 at 20:59:32 UTC, Timon Gehr wrote:
>> 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.

How does "auto" work? Can't the inner in&out be applied to the 
signature?

BR,
Piotrek


More information about the Digitalmars-d-announce mailing list