What the hell is wrong with D?
    jmh530 
    john.michael.hall at gmail.com
       
    Tue Sep 19 20:57:06 UTC 2017
    
    
  
On Tuesday, 19 September 2017 at 20:00:40 UTC, Brad Anderson 
wrote:
>
> If you want to help, I suggest trying to come up with a DIP 
> that addresses it while being conscious of how to avoid 
> breaking an enormous amount of code. I suspect it's a hard and 
> maybe impossible problem but if you are up for the challenge 
> I'm sure your efforts would be welcome.
Changing the operator precedence would certainly lead to enormous 
breakage.
Most use of the ternary operator is something like
result = a > b ? x : y;
and what he wants is to be forced to say
result = (a + b) ? x : y;
instead of
result = a + b ? x : y;
The problem is that addition/multiplication is above logical 
operators in the operator precedence. So if you were to do 
something like move conditional ternary above 
addition/multiplication, then you also move it above logical 
operators and you'd have to use
result = (a > b) ? x : y;
instead of
result = a > b ? x : y;
which kind of defeats the purpose.
    
    
More information about the Digitalmars-d-learn
mailing list