Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[XQuery] The 'member' keyword is still present on ForMemberBinding #49

Closed
rhdunn opened this issue Jan 16, 2021 · 3 comments
Closed

[XQuery] The 'member' keyword is still present on ForMemberBinding #49

rhdunn opened this issue Jan 16, 2021 · 3 comments
Labels
Bug Something that doesn't work in the current specification Editorial Minor typos, wording clarifications, example fixes, etc. XQuery An issue related to XQuery

Comments

@rhdunn
Copy link
Contributor

rhdunn commented Jan 16, 2021

The latest editor's draft (13 January 2021) moves the member keyword to a new ForMemberClause symbol:

ForMemberClause           ::=          "for" "member" ForMemberBinding ("," ForMemberBinding)*

With this change, the ForMemberBinding syntax has retained the optional member keyword from the previous change to ForBinding:

ForMemberBinding          ::=          "member"? "$" VarName TypeDeclaration? PositionalVar? "in" ExprSingle

This means that for member member ... and for member $a in [], member $b in [] ... are valid with the current grammar.

The ForMemberBinding grammar should be:

ForMemberBinding          ::=          "$" VarName TypeDeclaration? PositionalVar? "in" ExprSingle
@rhdunn
Copy link
Contributor Author

rhdunn commented Feb 20, 2021

The grammar and examples are mismatched (including in the XPath grammar). If the intention is to have the 'member' keyword on the binding, and not allow mixing member and sequence for clauses, the XPath grammar should be something like:

ForExpr ::= (SimpleForClause | SimpleForMemberClause)  "return"  ExprSingle
SimpleForClause ::= "for"  SimpleForBinding  (","  SimpleForBinding)*
SimpleForBinding ::= "$"  VarName  "in"  ExprSingle
SimpleForMemberClause ::= "for"  SimpleForMemberBinding  (","  SimpleForMemberBinding)*
SimpleForMemberBinding ::= "member" "$"  VarName  "in"  ExprSingle

and the XQuery grammar:

ForClause ::= "for"  ForBinding  (","  ForBinding)*
ForBinding ::= "$"  VarName  TypeDeclaration?  AllowingEmpty?  PositionalVar?  "in"  ExprSingle
ForMemberClause ::= "for"  ForMemberBinding  (","  ForMemberBinding)*
ForMemberBinding ::= "member"  "$"  VarName  TypeDeclaration?  PositionalVar?  "in"  ExprSingle

@benibela
Copy link

That really needs to be clarified

The example there is also for member $x in $expr1, member $y in $expr2 not for member $x in $expr1, $y in $expr2

Being able to mix arrays and sequences is much more flexible. Especially in XPath. In XQuery you can write mix for member $x in $expr1, $y in $expr2 as for member $x in $expr1 for $y in $expr2 but in XPath you would need for member $x in $expr1 return for $y in $expr2 which is a little longer

@rhdunn rhdunn added Bug Something that doesn't work in the current specification XQuery An issue related to XQuery Editorial Minor typos, wording clarifications, example fixes, etc. labels Sep 14, 2022
@ChristianGruen ChristianGruen added this to the QT 4.0 milestone Oct 14, 2022
@michaelhkay
Copy link
Contributor

I believe this bug has been fixed and we can close the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something that doesn't work in the current specification Editorial Minor typos, wording clarifications, example fixes, etc. XQuery An issue related to XQuery
Projects
None yet
Development

No branches or pull requests

4 participants