DIP 1009--Improve Contract Usability--Preliminary Review Round 2 Begins

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 21 12:36:08 PDT 2017


On Fri, Jul 21, 2017 at 01:51:05PM +0000, Mike Parker via Digitalmars-d wrote:
> DIP 1009 is titled "Improve Contract Usability".
> 
> https://github.com/dlang/DIPs/blob/master/DIPs/DIP1009.md
[...]

As far as the meat of the proposal is concerned, I like it. The syntax
of the out-contract without an identifier `out(;...)` is unfortunate,
but understandable because otherwise it will cause an ambiguity with
the existing verbose syntax that we will continue to support.

However, I think the presentation of the DIP needs some work. For
example, the rationales and lines of reasoning that eventually led to
the currently proposed syntax, both from the original draft of this DIP
and from the ensuing discussion in the previous review thread, ought to
be included (of course, in summarized form -- no need to repeat the
back-and-forth of the original discussions, but just the eventual line
of thought). If possible, some of the discarded alternatives could be
mentioned along with the reasons why they were eventually decided
against.

In short, I feel that a more substantial discussion of how we arrived at
the current form of the proposal is important so that Walter & Andrei
can have the adequate context to appreciate the proposed syntax changes,
and not feel like this is just one possibility out of many others that
haven't been adequately considered.

Also, I think some discussion of how the new syntax will interact with
the existing one is warranted: for example, recommendations as to when
to use the new syntax, and when to revert to the old (if it's a one-line
contract, use the new syntax; if you need to write a for-loop in your
contract, the old syntax is still available, etc.). This will also help
to give W&A a better idea of how this proposal will fit in with the
current syntax.

And there should be at least one example of a body-less function
declaration with contracts, just to see what it looks like in that case.


T

-- 
Too many people have open minds but closed eyes.


More information about the Digitalmars-d mailing list