Why can’t do you this if you try to find out whether an int is between to numbers:
if(10 < x < 20)
Instead of it, you’ll have to do
if(10<x && x<20)
which seems like a bit of overhead.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
One problem is that a ternary relational construct would introduce serious parser problems:
When you try to express a grammar with those productions using a typical PGS, you’ll find that there is a shift-reduce conflict at the point of the first
<rel-op>. The parse needs to lookahead an arbitrary number of symbols to see if there is a second<rel-op>before it can decide whether the binary or ternary form has been used. In this case, you could not simply ignore the conflict because that would result in incorrect parses.I’m not saying that this grammar is fatally ambiguous. But I think you’d need a backtracking parser to deal with it correctly. And that is a serious problem for a programming language where fast compilation is a major selling point.