DIP 1003 Formal Review

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Tue May 16 09:24:34 PDT 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.


More information about the Digitalmars-d mailing list