On 20/08/16 21:00, Walter Bright wrote:
On 8/20/2016 8:25 AM, Shachar Shemesh wrote:
Actually, Adam's suggestion on how things should work is precisely how
C works

No, it's subtly different. Which is my point that one must be very, very
careful when proposing different behavior.


Can you give an example of an expression that would yield different results in both modes?


To frame the discussion in a constructive way, I'll suggest an algorithmic definition of (my interpretation of) Adam's proposal:

During static analysis, keep both the "most expanded" and the "least expanded" type of the expression parsed so far. "Least expanded" is the largest type actually used in the expression.

Upon use of the value, resolve which type to actually use for it. If the use type requests a type between least and most, use that type for evaluating the entire expression. If the use requests a type outside that range, use the one closest (and, if the use is below the range, complain about narrowing conversion).

If more than one use is possible (i.e. - overloading), use the largest one applicable.


I believe the above solves my problem, without losing compatibility with C (counter examples welcome, so we can continue the discussion in a productive way), and without foregoing erroring out on narrowing conversions.

Shachar

Reply via email to