[Bug 15044] [XQuery30] group by variables with associated expressions

https://www.w3.org/Bugs/Public/show_bug.cgi?id=15044

Michael Dyck <jmdyck@ibiblio.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |jmdyck@ibiblio.org
         Resolution|WORKSFORME                  |

--- Comment #3 from Michael Dyck <jmdyck@ibiblio.org> 2011-12-10 20:59:56 UTC ---
Consider the example:

    group by $g1 := $expr1, $g2 := $expr2

Is variable $g1 visible in $expr2?

In Andrew's proposal, the example transforms to:
    let $g1 := $expr1
    let $g2 := $expr2
    group by $g1, $g2
and the rules for let clauses tell us that $g1 is indeed visible in $expr2.

In the current wording, the question does not appear to be addressed. To answer
it, I think we'd have to make some changes in the preamble of 3.10.1 "Variable
Bindings", including "group by" and putting it on the same footing as "for",
"let", and "count".

----------------------------------------------

Consider another example:

    group by $g1 := $expr1, $g1 := $expr2

(Note that $g1 appears twice.) Is this legal, and if so, what does it mean?

In Andrew's proposal, the example transforms to:
    let $g1 := $expr1
    let $g1 := $expr2
    group by $g1, $g1
The let clauses are certainly legal (the second $g1 occludes the first). The
group by clause would then have two references to the latter $g1 (and so would
be equivalent to just "group by $g1").

If we go with the current wording plus changes to 3.10.1,
    group by $g1 := $expr1, $g1 := $expr2
would be legal, but (unlike with Andrew's proposal) the two $g1 would be bound
to different values, and so provide two grouping keys.

Or we could add a rule that the variables in a GroupingSpecList must have
different names.

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Saturday, 10 December 2011 21:02:04 UTC