What the hell is wrong with D?

Tristan B. Kildaire deavmi at disroot.org
Wed Oct 4 20:54:16 UTC 2017


On 2017/09/19 19:40, EntangledQuanta wrote:
> 
>      writeln(x + ((_win[0] == '@') ? w/2 : 0));
>      writeln(x + (_win[0] == '@') ? w/2 : 0);
> 
> The first returns x + w/2 and the second returns w/2!
> 
> WTF!!! This stupid bug has caused me considerable waste of time. Thanks 
> Walter! I know you care so much about my time!
> 
> I assume someone is going to tell me that the compiler treats it as
> 
> writeln((x + (_win[0] == '@')) ? w/2 : 0);
> 
> Yeah, that is really logical! No wonder D sucks and has so many bugs! 
> Always wants me to be explicit about the stuff it won't figure out but 
> it implicitly does stuff that makes no sense. The whole point of the 
> parenthesis is to inform the compiler about the expression to use. Not 
> use everything to the left of ?.
> 
> Thanks for wasting some of my life... Just curious about who will 
> justify the behavior and what excuses they will give.
When you get too angry about the little things in life. "There are 
people dying in the world and this angers you, chill".


More information about the Digitalmars-d-learn mailing list