bearophile wrote:
> My little proposal for D is to turn the following into a syntax
> error, to avoid possile programmer mistakes (so the programmer must
> put parentheses here to make it compile):
> 
> x ? y : a ? b : c

The ternary operator is not ambiguous, I see no need for making it an
error. I have used such constructs very often, with no problem:

writefln("Printer is %s.",
         status == OFFLINE      ? "offline"      :
         status == ONLINE       ? "online"       :
         status == CHECK        ? "out of paper" :
         status == ONLINE_CHECK ? "on fire"      :
         "unknown status");

That would become a real mess of parenthesis.

Reply via email to