Hi, The documentation for the utility module [1] says certain functions will be removed in version 11 because they will be in XPath 4.0. However, util:if has been removed from the documentation and I think there is no equivalent function in this case. util:if is an alternative syntax for the BaseX Ternary operator [2].
( I have used it because it was easier than trying to get my XQuery parser EBNF to accept $ok ?? 1 !! 0 etc)
Is util:if to be removed?
/Andy [1] https://docs.basex.org/wiki/Utility_Module#util:if [2] https://docs.basex.org/wiki/XQuery_Extensions#Ternary_If
…thanks for the pointer. I’ve revised the documentation.
One property of util:if was that you could omit the argument for the else branch. We decided to drop util:if, because the specification now provides a new syntax for if expressions where the else branch is optional:
if ($test) { $then } if ($test) { $then } else { $else }
The ternary operator was temporarily added to the spec as an official feature, but we eventually dropped it again to reduce the number of different notations for existing features (unfortunately, the popular A ? B : C syntax was no option, as ? is already used for lookups).
On Mon, Nov 20, 2023 at 1:15 PM Andy Bunce bunce.andy@gmail.com wrote:
Hi, The documentation for the utility module [1] says certain functions will be removed in version 11 because they will be in XPath 4.0. However, util:if has been removed from the documentation and I think there is no equivalent function in this case. util:if is an alternative syntax for the BaseX Ternary operator [2].
( I have used it because it was easier than trying to get my XQuery parser EBNF to accept $ok ?? 1 !! 0 etc)
Is util:if to be removed?
/Andy [1] https://docs.basex.org/wiki/Utility_Module#util:if [2] https://docs.basex.org/wiki/XQuery_Extensions#Ternary_If
Hi Andy, hi Rob,
util:if is back again.
Just give me a note if there are other functions in the Utility Module (or in the HOF Module) that you rely on.
Best, Christian
On Mon, Nov 20, 2023 at 1:15 PM Andy Bunce bunce.andy@gmail.com wrote:
Hi, The documentation for the utility module [1] says certain functions will be removed in version 11 because they will be in XPath 4.0. However, util:if has been removed from the documentation and I think there is no equivalent function in this case. util:if is an alternative syntax for the BaseX Ternary operator [2].
( I have used it because it was easier than trying to get my XQuery parser EBNF to accept $ok ?? 1 !! 0 etc)
Is util:if to be removed?
/Andy [1] https://docs.basex.org/wiki/Utility_Module#util:if [2] https://docs.basex.org/wiki/XQuery_Extensions#Ternary_If
basex-talk@mailman.uni-konstanz.de