DIP 1006 - Preliminary Review Round 1

Walter Bright newshound2 at digitalmars.com
Sun Mar 4 00:32:20 UTC 2018


On 4/12/2017 4:25 AM, Mike Parker wrote:
> DIP 1006 is titled "Providing more selective control over contracts".
> 
> https://github.com/dlang/DIPs/blob/master/DIPs/DIP1006.md


Currently, we have 3 switches that affect the asserts: `release`, `boundscheck`, 
and `unittest`. The documentation for these new additions is completely 
confusing. No mention is made of interactions with the latter two. No mention is 
made on what happens if more than one of these switches is used, or what if the 
same switch appears multiple times.

I'd like to see a chart enumerating all the behaviors influenced by these 
switches, the default behavior, and which switch settings do what.

Each switch, when applied, should specify what happens to each behavior:

1. turned on
2. turned off
3. not affected

and that the switches are applied in the order they appear on the command line.

The use of comma-separated arguments is something I've argued against for other 
switches. The use of `-release=in -release=out` should be fine and is less 
confusing/buggy to implement.

The idea that `-release=in` actually turns *off* `in` is completely topsy-turvy.

Ideally, the whole thing should be simplified to its fundamentals:

1. leave the old switches as they are
2. Add a new switch, let's say "check":

    -check     turn on all checks
    -check=on  turn on all checks
    -check=off turn off all checks
    -check=xxx turn on check xxx
    -check=yyy turn on check yyy

simple, easy to explain, easy to comprehend, easy to implement, easy to extend 
with new checks.


More information about the Digitalmars-d mailing list