Value Range Propigation Spec

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Thu Oct 23 23:25:50 PDT 2014


deadalnix:

> There are possibilities to do more, but compatibility require
> that we put the line somewhere.

The line is still moving forward.


> The current line seems to be to do VRP on expression and compile
> time know values. Is that right ?

No, it's not right. VRP was recently improved to keep the value 
range of run-time immutable values. And some VRP was added to 
foreach loops. So now this is accepted:


void main(in string[] args) {
     immutable size_t len = args.length % 10;
     ubyte x = len;
     ubyte[] a;
     foreach (immutable i; 0u .. len)
         a ~= i;
}

Bye,
bearophile


More information about the Digitalmars-d mailing list