W3C home > Mailing lists > Public > public-qt-comments@w3.org > December 2009

[Bug 8502] New: [XQuery 1.1] Organization of sections

From: <bugzilla@wiggum.w3.org>
Date: Tue, 15 Dec 2009 22:17:35 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-8502-523@http.www.w3.org/Bugs/Public/>
http://www.w3.org/Bugs/Public/show_bug.cgi?id=8502

           Summary: [XQuery 1.1] Organization of sections
           Product: XPath / XQuery / XSLT
           Version: Working drafts
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQuery 1.1
        AssignedTo: jonathan.robie@redhat.com
        ReportedBy: mike@saxonica.com
         QAContact: public-qt-comments@w3.org


The new XQuery 1.1 WD (published 15 Dec 2009) appears to have some editorial
problems in the organization of sections.

Section 3.1 is about Primary Expressions. Of the nine kinds of primary
expression, seven are described more fully in subsections 3.1.1 to 3.1.7 (the
other two, ordered and unordered expressions, are in section 3.9, which is not
a problem). But section 3.1.8 describes dynamic function invocations, which are
not primary expressions: placing them at this point in the spec, under the
heading "Primary Expressions" is therefore misleading.

Section 3.2.2 is headed "Predicates" and tries to describe both predicates as
used in Axis steps, and predicates as used in filter expressions (which are not
introduced until 3.3.2). But this isn't clear, because grammatically the two
constructs are now quite separate (and there are semantic differences too). The
inclusion of the production for FilterExpr in 3.2.2 is a red herring: this is
not what the section is about.

Section 3.3.2 is headed "Filter Expressions", which corresponds to the
metasymbol FilterExpr. Except that it doesn't any more: the definition of
"filter expression" is "A filter expression consists simply of a primary
expression followed by zero or more predicates.", which is narrower than the
metasymbol FilterExpr, which covers both filtering and dynamic function
invocation. The syntax of these two rather separate operations is now so
intertwined that it probably makes sense to cover the semantics in one place as
well.

In fact, the concept of "a primary expression followed by zero or more
predicates" really doesn't match anything in the grammar any more. I suggest
that we redefine it as being "an expression followed by a [single] predicate",
and change the prose accordingly.

A related problem is that 3.3.2 starts with two grammar productions (FilterExpr
and PredicateList) neither of which references the other. PredicateList doesn't
belong here.

If we're allowed to write the grammar to match the semantics (which is what I
have always done in my books), I would write it as 

PostfixExpr := PrimaryExpr | FilterExpr | DynamicFunctionInvocation

FilterExpr := PostfixExpr '[' ExprSingle ']'

DynamicFunctionInvocation := PostfixExpr "(" (ExprSingle ("," ExprSingle)*)?
")"

Of course this is problematic because it has to be refactored to turn it into a
grammar that can be implemented without lookahead: but it's much clearer to the
human reader, and gives much better "hooks" into the prose describing the
semantics. I don't know if there is a solution to this problem: perhaps we
could present both grammars, assert that they are equivalent, and use the one
given here as the basis for describing the semantics. (Note that the current
metasymbol DynamicFunctionInvocation represents only the argument list,
although the semantic description in 3.1.8 treats it as if it is a complete
expression).

This approach would allow the structure

3.3.2 Postfix Expressions

3.3.2.1 Filter Expressions

3.3.2.2 Dynamic Function Invocation

There's always going to be a bit of messiness because predicates are used both
in axis steps and in filter expressions, with slightly different semantics, but
we can try harder to minimise the confusion.


-- 
Configure bugmail: http://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 Tuesday, 15 December 2009 22:17:37 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:14:59 GMT