[Bug 2318] SequenceType with occurrence in For/Some/Every expr doesn't make sense

http://www.w3.org/Bugs/Public/show_bug.cgi?id=2318

           Summary: SequenceType with occurrence in For/Some/Every expr
                    doesn't make sense
           Product: XPath / XQuery / XSLT
           Version: Last Call drafts
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQuery
        AssignedTo: chamberl@almaden.ibm.com
        ReportedBy: martin@x-hive.com
         QAContact: public-qt-comments@w3.org


I think there is a (somewhat minor) bug in the XQuery specification
about sequence type matching. The grammar states:

[34]   ForClause         ::=    <"for" "$"> VarName TypeDeclaration? ...
[118]  TypeDeclaration   ::=    "as" SequenceType
[119]  SequenceType      ::=    (ItemType OccurrenceIndicator?)
                                | <"empty-sequence" "(" ")">

and similar rules for Some, Every and Let. I think these rules should
rather reference/descend directly into ItemType (or in a special rule
including the "as") as the following statements do not make any sense 
to me (same for some&every):

for $x as xs:string* in ...
for $x as xs:string+ in ...
for $x as xs:string? in ...
for $x as empty-sequence() in ...

The only thing that adds any semantic meaning is the empty-sequence()
statement which I would interpret as "give an error if this yields
something". But it's really cryptic and there are better ways to do
this.

Received on Wednesday, 28 September 2005 15:50:14 UTC