Value Range Propigation Spec

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Fri Oct 24 02:42:57 PDT 2014


Stefan Koch:

> The problem with vrp for non-static immutable values is, that 
> vrp becomes a runtime-thing and I would like to avoid that!
> Tracking the range of a Variable at runtime could cause 
> significant overhead!

Nope, the value range tracking is purely compile-time.


> 2. implementation is not straight-forward and bugs could be 
> hard to find.

It's much better to remove bugs from the compiler than from an 
unbound amount of user code that uses casts incorrectly.


> 3. Code that relays on this may not be easy to read,

I don't believe this. Please show one or more examples.


> and it may be hard for the programmer to see why a particular 
> assignment does not need a cast!

And this is bad because?


> But if we have much logic and control-flow between the 
> assignment and the definition of the assigning variable then 
> not haveing an explicit cast could cause a bit of puzzlement.

I think most D programmers are used to C/C++ coding, that doesn't 
require most of those casts. I don't think that "puzzlement" is 
real, or problematic.

Bye,
bearophile


More information about the Digitalmars-d mailing list