<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>2318</bug_id>
          
          <creation_ts>2005-09-28 15:47:47 +0000</creation_ts>
          <short_desc>SequenceType with occurrence in For/Some/Every expr doesn&apos;t make sense</short_desc>
          <delta_ts>2005-09-29 14:08:43 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>XQuery 1.0</component>
          <version>Last Call drafts</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Martin Probst">martin</reporter>
          <assigned_to name="Don Chamberlin">chamberl</assigned_to>
          
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>6551</commentid>
    <comment_count>0</comment_count>
    <who name="Martin Probst">martin</who>
    <bug_when>2005-09-28 15:47:47 +0000</bug_when>
    <thetext>I think there is a (somewhat minor) bug in the XQuery specification
about sequence type matching. The grammar states:

[34]   ForClause         ::=    &lt;&quot;for&quot; &quot;$&quot;&gt; VarName TypeDeclaration? ...
[118]  TypeDeclaration   ::=    &quot;as&quot; SequenceType
[119]  SequenceType      ::=    (ItemType OccurrenceIndicator?)
                                | &lt;&quot;empty-sequence&quot; &quot;(&quot; &quot;)&quot;&gt;

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 &quot;as&quot;) as the following statements do not make any sense 
to me (same for some&amp;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 &quot;give an error if this yields
something&quot;. But it&apos;s really cryptic and there are better ways to do
this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>6568</commentid>
    <comment_count>1</comment_count>
    <who name="Don Chamberlin">chamberl</who>
    <bug_when>2005-09-29 08:45:48 +0000</bug_when>
    <thetext>Martin,
One of the most important principles of XQuery design is the orthogonality of 
the grammar. We define the basic parts of the grammar and use them consistently 
throughout the language--for example, the SequenceType production is used 
consistently wherever a type specification is needed.

As you have observed, a SequenceType is allowed to include an 
OccurrenceIndicator, which is not necessary when specifying a TypeDeclaration 
in a ForClause. However, if an OccurrenceIndicator is specified in this 
context, it is not harmful and its meaning is well-defined. For example, any 
variable binding that satisfies the SequenceType xs:integer also trivially 
satisfies the SequenceTypes xs:integer*, xs:integer+, and xs:integer?. I don&apos;t 
know any reason why a user would specify such a type in a ForClause, but I also 
don&apos;t know any reason to prohibit it. In general, we don&apos;t try to prevent users 
from writing expressions that are well-defined but useless.

On Sept. 28, 2005, the Query Working Group decided to close this comment 
without change to the XQuery specification. If you are satisfied with this 
resolution, please respond by closing this Bugzilla entry.

Thank you,
Don Chamberlin (on behalf of the Query Working Group) </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>6610</commentid>
    <comment_count>2</comment_count>
    <who name="Martin Probst">martin</who>
    <bug_when>2005-09-29 14:08:43 +0000</bug_when>
    <thetext>Well, that&apos;s fine with me, closing.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>