Precedence of otherwise
operator
#1024
Labels
Discussion
A discussion on a general topic.
Tests Added
Tests have been added to the test suites
XPath
An issue related to XPath
I made a mistake when specifying subsequence-where, caused by misunderstanding the precedence of the
otherwise
operator: see issue #1001.In the expression
I failed to realise that
otherwise
binds more tightly than+
.I'm opening the issue to solicit views as to whether we have got this right.
One might take the view that the closest thing to
otherwise
in other familiar language is the ternary conditional operator, which has lower precedence than anything else includingand
andor
; but then, its first operand is a boolean expression while it's relatively unlikely that the operands ofotherwise
will be boolean. I'm therefore thinking that it might be best to put it between 'eq' and '||`, so$a eq $b otherwise $c || $d
parses as
$a eq ($b otherwise ($c || $d))
The text was updated successfully, but these errors were encountered: