DIP 1003 Formal Review

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Tue May 16 12:25:25 PDT 2017


On 5/16/17 2:48 PM, Eugene Wissner wrote:
> On Tuesday, 16 May 2017 at 18:34:06 UTC, Steven Schveighoffer wrote:
>> On 5/12/17 12:17 PM, Mike Parker wrote:
>>> The first stage of the formal review for DIP 1003 [1], "Remove body as a
>>> Keyword", is now underway. From now until 11:59 PM ET on May 26 (3:59 AM
>>> GMT on May 27), the community has the opportunity to provide last-minute
>>> feedback. If you missed the preliminary review [2], this is your chance
>>> to provide input.
>>>
>>> At the end of the feedback period, I will submit the DIP to Walter and
>>> Andrei for their final decision. Thanks in advance to those of you who
>>> participate.
>>>
>>> [1]
>>> https://github.com/dlang/DIPs/blob/fbb797f61ac92300eda1d63202157cd2a30ba555/DIPs/DIP1003.md
>>>
>>>
>>>
>>> [2] http://forum.dlang.org/thread/qgxvrbxrvkxtimzvnetu@forum.dlang.org
>>
>> Before we go down endlessly debating which keywords would work best to
>> replace body here, can someone please inform the crowd why just having
>> body remain as it is now, but *not* be a keyword is unworkable?
>>
>> The more I think about it, the more I think that option 1 is the far
>> far far superior option. Zero existing code breaks, and we now have
>> access to our own body symbols (and we don't even have to go through a
>> deprecation period). However, if there is a missing lynch pin that
>> shows why this cannot work, then it's better to take it off the table
>> now.
>>
>
> 1) Consistency with functions without contracts.

This only applies to the "naked" version which has ugly }{ in it. The 
other options people are asking about are replacing body with a keyword, 
which I think you agree would be bad for consistency?

> 2) I wouldn't like to have body optional because: it introduces an
> additional style guide rule: there will be people who will omit it and
> people who will say: explicitely is better, always use body.

Currently, body is required. It would still be required. Just not a 
keyword. I'm specifically asking if just removing the 'keyword-ness' of 
it is not doable for some reason.

Note: body is optional for non-contract functions (yes, void foo() body 
{ } is valid). I don't see a rash of people promoting having body there.

> 3) Syntax highlighting: Editors that work with regex will mark body in
> all contexts as a keyword.

This is a solved problem. Create a C# file, then write 'get' or 'set' 
somewhere that's not inside a property, and see if it's highlighted 
differently.

> 4) I know body isn't reserved anywhere, I can use it without thinking
> abot the contexts (good for new comers who may think body is a reserved
> keyword if it is used as such in some contexts).

I think maybe you misunderstand what I was asking.

-Steve


More information about the Digitalmars-d mailing list