May 16, 2017
On 16.05.2017 17:47, Jonathan M Davis via Digitalmars-d wrote:
> ...
>
> And having to
> have body (or function whatever other keyword we might put there) just makes
> contracts that much more verbose

That's seriously exaggerated.

> - as well as being inconsistent with how
> functions bodies are declared when there are no contracts.
>
> Honestly, as nice as it would be to get the body keyword back as an
> identifier, I care _way_ more about not having a redundant keyword for the
> function body.

It's not redundant. Removing it makes the code look bad. There is a reason why Walter added it to the language.

> I'd be all for removing it from contracts even if we never
> got it back as an identifier. I've always found needing to add body to be
> very annoying, and I frequently forget it,

Impossible. You "almost never use" contracts.

> because it's not there normally.

It's always there if you write a function with contracts.

> It's just making contracts longer without adding extra information, and
> contracts are _way_ too verbose even without the extra keyword there, let
> alone with it.

I'm not against adding less verbose options, but just removing 'body' is not a good way to do it. All that does is to go from verbose to verbose and ugly. That does not justify a change that breaks all D code that uses contracts.


>
> IMHO, if we remove body as a keyword but replace it with something else in
> contracts, we've lost out on a big opportunity for some language cleanup.
>
> - Jonathan M Davis
>

I disagree that changing contract syntax in the way you suggest constitutes a cleanup. I agree that changing 'body' to 'function' is a similarly bad option though.
May 16, 2017
On Tuesday, 16 May 2017 at 15:22:12 UTC, Timon Gehr wrote:
> auto foo()in{
>     assert(true);
> }out{
>     assert(true);
> }{
>     return 3;
> }
>
> Are you really arguing for this?
> I don't want to write code like this.

It's not any better than this:

auto foo()in{
    assert(true);
}out{
    assert(true);
}body{
    return 3;
}

They are both bad, but not because of the presence or absence of the `body` keyword, in my opinion.

May 16, 2017
On Tuesday, 16 May 2017 at 17:42:11 UTC, MysticZach wrote:
> On Tuesday, 16 May 2017 at 15:22:12 UTC, Timon Gehr wrote:
>> auto foo()in{
>>     assert(true);
>> }out{
>>     assert(true);
>> }{
>>     return 3;
>> }
>>
>> Are you really arguing for this?
>> I don't want to write code like this.
>
> It's not any better than this:

I meant any worse.
May 16, 2017
On Sunday, 14 May 2017 at 15:39:12 UTC, Walter Bright wrote:
> On 5/12/2017 9:17 AM, Mike Parker wrote:
>> The first stage of the formal review for DIP 1003 [1], "Remove body as a
>> Keyword", is now underway.
>
> A combination of Options 1 and 2:
>
> 1. Introduce 'function' as an alternative to 'body'.

How about using some other keyword like, with, else, scope or do, for example.
Would they read better than 'function' (i.e. function with vs. function function vs. function body)? Let's experiment a bit.

int foo()
in
{
}
out
{
}
with
{
  bar();
}

-- or

int foo()
in
{
}
out
{
}
else  // I guess this could be too confusing with template constraint? See below.
{
  bar();
}

int foo(T)() if(cond)
in
{
}
out
{
}
else
{
}

-- or

int foo()
in
{
}
out
{
}
scope
{
  bar();
}

-- or

int foo()
in
{
}
out
{
}
do
{
  bar();
}
May 16, 2017
On 05/16/2017 01:59 PM, Random D user wrote:
>
> int foo()
> in
> {
> }
> out
> {
> }
> do
> {
>   bar();
> }

Can't deny I like that. -- Andrei
May 16, 2017
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.

-Steve
May 16, 2017
On 16.05.2017 19:44, MysticZach wrote:
> On Tuesday, 16 May 2017 at 17:42:11 UTC, MysticZach wrote:
>> On Tuesday, 16 May 2017 at 15:22:12 UTC, Timon Gehr wrote:
>>> auto foo()in{
>>>     assert(true);
>>> }out{
>>>     assert(true);
>>> }{
>>>     return 3;
>>> }
>>>
>>> Are you really arguing for this?
>>> I don't want to write code like this.
>>
>> It's not any better than this:
>
> I meant any worse.

Yes, it is actually worse.
May 16, 2017
On 16.05.2017 20:06, Andrei Alexandrescu wrote:
> On 05/16/2017 01:59 PM, Random D user wrote:
>>
>> int foo()
>> in
>> {
>> }
>> out
>> {
>> }
>> do
>> {
>>   bar();
>> }
>
> Can't deny I like that. -- Andrei

Beats options 2 and 3.
May 16, 2017
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.
>
> -Steve

1) Consistency with functions without contracts.
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.
3) Syntax highlighting: Editors that work with regex will mark body in all contexts as a keyword.
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).
May 16, 2017
On Tuesday, 16 May 2017 at 16:10:56 UTC, David Gileadi wrote:
> One possible substitute for the `function` keyword in option 2 could be `do`. I'm not convinced it's a good substitute, but I thought I'd throw it out there.

Looks weird for a C-style language imho.