DIP 1003 Formal Review

MysticZach via Digitalmars-d digitalmars-d at puremagic.com
Thu May 18 07:32:18 PDT 2017


On Thursday, 18 May 2017 at 13:06:38 UTC, Petar Kirov 
[ZombineDev] wrote:
> On Thursday, 18 May 2017 at 12:56:31 UTC, Meta wrote:
>> This is pretty much the same as option 2. The short-term 
>> contextual part is covered by Walter's suggestion.
>
> No it's not. What MysticZach suggests, and what I suggested 
> even earlier [0] is to make 'body' contextual and optional 
> which is very different than replacing it with another keyword. 
> The main difference is that it would make code that uses 
> contracts cleaner and there would be no breakage. In contrast, 
> deprecating 'body' is a breaking change.
>
> IMO, option 2 and variations of it are *the worst* way forward.
>
> [0]: 
> http://forum.dlang.org/post/pmldhzgcpuoydllfrbei@forum.dlang.org

Yes. Our proposal is actually a variation on option 3. Added to 
the current DIP, it would read: "Option 6: allow omitting `body`, 
and also allow it as an identifier"

The two known downsides to this option so far are:

1. Different code will continue include the keyword version of 
`body` or not based on arbitrary programmer preferences.

2. Syntax highlighters that choose to highlight the word `body` 
will have to be modified to detect its different uses.

Note that in the case of 1., strong preferences have been stated 
here for both styles, thus increasing the feeling that it's okay 
to allow both. Also note that the opposition to any inclusion of 
contextual keywords on principle is largely countered by the fact 
that there is no danger of semantic ambiguity between the two 
uses of `body` here.



More information about the Digitalmars-d mailing list