BaseX 10.7 and util:if

Monday, 20 November 2023 · 3 messages · last reply 23 Nov 2023
AB
Andy Bunce20 Nov 2023 13:15 #
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
CG
Christian Grün21 Nov 2023 16:45 #
…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).
Quoted text · Andy Bunce · 17 lines
On Mon, Nov 20, 2023 at 1:15 PM Andy Bunce <bunce.andy at 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 >
CG
Christian Grünin reply to Andy Bunce, 20 Nov 2023, 13:1523 Nov 2023 15:30 #
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
Quoted text · Andy Bunce · 17 lines
On Mon, Nov 20, 2023 at 1:15 PM Andy Bunce <bunce.andy at 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 >

⚡Generated with XQuery