DIP 1003: remove `body` as a keyword

Timon Gehr via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Thu Nov 24 08:08:50 PST 2016


On 24.11.2016 12:35, Sönke Ludwig wrote:
> Am 23.11.2016 um 21:32 schrieb Timon Gehr:
>> On 23.11.2016 11:15, Sönke Ludwig wrote:
>>>
>>>     scope (exit) { assert(n > 0); }
>>>     {
>>>         n += 1;
>>>     }
>>
>> This is not a counterexample, because the block statement following the
>> scope statement is not part of the scope statement. I.e. if anything, it
>> is bad that this looks similar, because it is grammatically different.
>
> The function body isn't part of the "in"/"out" contract either. I don't
> see the point here.
> ...

There can be no free-standing contract, it's part of the function signature.

>> (Also, in my code there are usually exactly zero block statements nested
>> directly in block statements.)
>
> The whole topic in general so far seems to be mainly hinged around
> personal taste (me included). Not sure if we'll be able to reach consent
> for anything but option 1.

That's understood (this is about syntax).

BTW, a point against option 2 is: "body" is actually one of the few 
keywords that D has that have adequate names. It's the body that 
follows, not the function.


More information about the Digitalmars-d-announce mailing list