Value Range Propigation Spec

John Colvin via Digitalmars-d digitalmars-d at puremagic.com
Thu Oct 23 13:48:13 PDT 2014


On Wednesday, 22 October 2014 at 20:32:39 UTC, Walter Bright 
wrote:
> On 10/22/2014 2:31 AM, Shammah Chancellor wrote:
>> A couple of us working on SDC are trying to get ValueRange 
>> propigation
>> implemented.   I was wonder if someone could offer some 
>> insight as to how VRP
>> works in DMD.   If for example, trying to get the value range 
>> of a global, what
>> is the expected behavior?
>>
>> It seems as though VRP is a language feature, and not a 
>> compiler feature --
>> since this allows some code to compile and not others.   Is 
>> there a
>> specification for how it should work somewhere?  If not, it's 
>> hard to implement
>> other compilers that will not generate errors in the same 
>> circumstances as DMD.
>>
>
> VRP is definitely a language feature, not a compiler feature. 
> The specification is straightforward - a narrowing conversion 
> can be implicitly performed if it can be proved that it would 
> not lose information.
>
> How it works, though, is kinda tricky, and the only guide to it 
> is the compiler source code.

Seeing as it affects semantics, should there not be a minimum 
standard of what must be provable by a D compiler?

Inference is great, but portability matters too.


More information about the Digitalmars-d mailing list