On Tuesday, 19 September 2017 at 19:16:05 UTC, EntangledQuanta wrote:

()?: is not ambiguous!

The D community preaches all this safety shit but when it comes down to it they don't seem to really care(look at the other responses like like "Hey, C does it" or "Hey, look up the operator precedence"... as if those responses are meaningful).


I sympathize that it was a difficult to find problem. Happens to me a lot. Nevertheless, I pretty much never use ternary operators because Matlab was my first language was it doesn't have them. I'm always writing out if() { } else { }. So it's not really an error that happens for me.

The point that others and myself were making about C is that your initial post was very critical of D and Walter. Unduly, IMO. You were blaming D for the problem, when it turns out that in virtually every language that uses this syntax it works this way (and I checked like 10, just to be sure). Harshly criticizing Walter for something that is a generally accepted way of doing things across many programming languages is unreasonable. D never promised to be the greatest language ever whose users never ever write any buggy code at all. It's aims are a bit more limited than that.

There's an easy solution to your problem: use more parentheses with conditional ternary operators.

Reply via email to