DIP 1003 Formal Review

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Tue May 16 06:50:59 PDT 2017


On Tuesday, May 16, 2017 12:50:37 Meta via Digitalmars-d wrote:
> On Tuesday, 16 May 2017 at 10:28:09 UTC, Kagamin wrote:
> > On Monday, 15 May 2017 at 01:18:02 UTC, Jonathan M Davis wrote:
> >> So, while I do like the idea of getting the word body back as
> >> an identifier, what really appeals to me here is getting rid
> >> of the need for it with contracts. And using function instead
> >> of body doesn't help that at all.
> >
> > The purpose of the DIP is to reclaim the keyword. If you want
> > shorter contracts, then:
> >
> > int f(int a)
> >
> >   in assert(a>0)
> >   out(r) assert(b==a+1)
> >
> > {
> >
> >   return a+1;
> >
> > }
>
> Yes, please keep the discussion focused on the the removal of
> `body` and how to best go about that. I do agree though that we
> could and should make contracts shorter. Maybe in another DIP
> after this one.

All I'm arguing for is that if we're removing body as a keyword, there's no
need to replace it with function or any other word in contracts. We can
simply deprecate its use as a keyword and not replace it, letting it then be
used as a normal identifier in whatever fashion makes the most sense.
Actually changing the overall syntax of contracts is a whole other can of
worms.

- Jonathan M Davis



More information about the Digitalmars-d mailing list