RFC: Value range propagation for if-else
bearophile via Digitalmars-d
digitalmars-d at puremagic.com
Wed Jun 18 01:28:05 PDT 2014
Lionello Lunesu:
>> ubyte foo(immutable int x)
>> in {
>> assert(x >= 0 && x <= ubyte.max);
>> } body {
>> return x;
>> }
>
> Yeah, I wanted to support "assert" as well, but it doesn't
> create a scope so it'll be a bit trickier to implement.
If you have an assert in a pre-condition and the argument is
const, then the body{} is the scope you look for.
Bye,
bearophile
More information about the Digitalmars-d
mailing list