Closed sbromberger closed 9 years ago
I don't think it's that obscure a difference. The AST clearly distinguishes these two constructs and would never have trouble implementing different logic.
It's effectively the same thing as saying that the second +
of the ++
operator isn't equivalent to the +
operator. The ternary operator may be separated by other cruft, but it's still a single operator and not equivalent to the colon operator.
so we're distinguishing between the ": operator" and the "ternary operator", both of which are represented by a single colon?
Nope, the ternary operator is a three-part operator that looks like a ? b : c
.
Got it. Thanks for the explanation.
What about statements of the format
a = (x > 0)? foo : bar
? Should we have no spaces around that colon? (Arguably, the colon here is not functioning as an operator, but that's a pretty obscure difference.)