DIP 1009 (Add Expression-Based Contract Syntax) Accepted

really? whomever at whatever.com
Wed Apr 11 05:23:58 UTC 2018


On Friday, 6 April 2018 at 17:36:20 UTC, H. S. Teoh wrote:
>
> Yeah, I think having expression syntax will make contracts more 
> readable.  We'll just have to see.
>

Sorry, but I fail to see how (1) is more readable than (2)

(1)
in(s.length > 0, "s must not be empty")

(2)
in { assert(s.length > 0, "s must not be empty"); }


In (1) The assert .. is removed.
In (1) The scope indicators {} .. are removed.
In (1) The semicolon..is removed.

Removing all these things equates to being more readable??

Sure, it makes it more concise, but more readable??

I assert that it does not. But now..do I use the assert keyword.. 
or not? Do I end with semicolon..or not??

This just removes things that are still needed elsewhere in your 
code, but now... you have to remember that sometimes you need 
those things, and sometimes you don't.

Better to have consistency over conciseness

so glad to hear that existing syntax will remain.
(well, till someone decides that needs to go too)


More information about the Digitalmars-d-announce mailing list