Why D is not popular enough?
    Adam D. Ruppe via Digitalmars-d 
    digitalmars-d at puremagic.com
       
    Fri Aug 19 06:36:05 PDT 2016
    
    
  
On Friday, 19 August 2016 at 08:31:39 UTC, Marco Leise wrote:
> If we hypothetically switched to a ubyte+ubyte=ubyte semantic, 
> then code like this breaks silently:
However, if it took the entire statement into account, it could 
handle that... by my rule, it would see there's a float in there 
and thus automatically cast a and b to float before doing 
anything.
The compiler would parse
Assign(float, Multiply(float, Parenthetical(Add(a, b))))
In a semantic transformation step, it would see that since the 
lhs is float, the rhs is now casted to float, then it does that 
recursively through it all and a and b get promoted to float so 
the bits are never lost.
I really do think that would work.
Alas, I don't see D ever changing anyway, this is too deep in its 
C bones.
    
    
More information about the Digitalmars-d
mailing list