Numeric limits tracking

bearophile bearophileHUGS at lycos.com
Sun May 12 18:10:40 PDT 2013


Walter Bright:

> There's a forward reference going on. We cannot semantically 
> evaluate s=x until we semantically evaluate the rest of the 
> function in order to know that x is or is not reassigned.

A first step to improve the situation is to propagate the range 
of const/immutable values inside a function:

void main() {
     uint x = 1000;
     immutable y = x % 256;
     ubyte z = y; // currently error.
}

Bye,
bearophile


More information about the Digitalmars-d mailing list