More fun with autodecoding
jmh530
john.michael.hall at gmail.com
Tue Sep 11 14:58:21 UTC 2018
On Tuesday, 11 September 2018 at 02:00:29 UTC, Nicholas Wilson
wrote:
> [snip]
>
> https://github.com/dlang/DIPs/pull/131 will help narrow down
> the cause.
I like it, but I worry people would find multiple ifs confusing.
The first line of the comment is about using static asserts and
in contracts, but it looks like static asserts are allowed in in
contracts for functions [1]. You can do the same thing in
structs/classes with invariant blocks (but in contracts are not
allowed). So basically, the same behavior for if can be reduced
to in contracts with static asserts already. Multiple ifs would
just be a slightly less verbose way to accomplish the same thing.
I suppose one issue might be that contracts are not compiled in
during release mode, but I think release only impacts normal
asserts, not static asserts.
Is there any reason why this is not sufficient?
[1] https://run.dlang.io/is/lu6nQ0
More information about the Digitalmars-d
mailing list