<?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>28901</bug_id>
          
          <creation_ts>2015-07-05 20:52:50 +0000</creation_ts>
          <short_desc>[XP 3.1] Unary Lookup</short_desc>
          <delta_ts>2015-07-14 21:53:47 +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>XPath 3.1</component>
          <version>Candidate Recommendation</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</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="Michael Kay">mike</reporter>
          <assigned_to name="Jonathan Robie">jonathan.robie</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>121609</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2015-07-05 20:52:50 +0000</bug_when>
    <thetext>Section 3.11.3.1 contains the text

If the context item is an array, the UnaryLookup operator is equivalent to the following expression:

for $k in 1 to array:size(.)
return .($k)

This is true only for the wildcard form of the operator, but that is covered later in the section.

I believe that the previous statement

If the context item is a map, the UnaryLookup operator is equivalent to the following expression:

for $k in KS
return .($k)

is true also when the context item is an array.

Using nested lists to make clear the scope of the conditionals in this section would make it much clearer. I would be inclined to structure it as follows, even though this involves duplication:

1. If the context item is a map:
1.1 If KeySpecifier is an NCName:
1.2 If KeySpecifier is an IntegerLiteral:
1.3 If KeySpecifier is a ParenthesizedExpr:
1.4 If KeySpecifier is a wildcard (&quot;*&quot;)
2. If the context item is an array:
2.1 If KeySpecifier is an NCName: (always an error)
2.2 If KeySpecifier is an IntegerLiteral:
2.3 If KeySpecifier is a ParenthesizedExpr:
2.4 If KeySpecifier is a wildcard (&quot;*&quot;):
3. Otherwise (error)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>121610</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2015-07-05 20:58:36 +0000</bug_when>
    <thetext>In 3.11.13.2 we read

The semantics of E?S are equivalent to for $a in E, $b in S return $a($b) , where E is an expression on the left of the postfix ? operator and ?S is the unary lookup operator described in 3.11.3.1 Unary Lookup.

This doesn&apos;t work. &quot;?S&quot; isn&apos;t a unary lookup operator.

I think this should be

The semantics of E?S are equivalent to 

for $a in E return $a ! ?S

where ?S uses the unary lookup operator described in 3.11.3.1 Unary Lookup</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>121614</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2015-07-06 07:15:13 +0000</bug_when>
    <thetext>Note also, I believe that if $A is an array, then $A?* has the same result as array:flatten($A); it would be useful to point out this relationship, or even to use it as the normative specification of $A?*</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122042</commentid>
    <comment_count>3</comment_count>
    <who name="Jonathan Robie">jonathan.robie</who>
    <bug_when>2015-07-14 21:53:47 +0000</bug_when>
    <thetext>(In reply to Michael Kay from comment #0)

&gt; Using nested lists to make clear the scope of the conditionals in this
&gt; section would make it much clearer. I would be inclined to structure it as
&gt; follows, even though this involves duplication:
&gt; 
&gt; 1. If the context item is a map:
&gt; 1.1 If KeySpecifier is an NCName:
&gt; 1.2 If KeySpecifier is an IntegerLiteral:
&gt; 1.3 If KeySpecifier is a ParenthesizedExpr:
&gt; 1.4 If KeySpecifier is a wildcard (&quot;*&quot;)
&gt; 2. If the context item is an array:
&gt; 2.1 If KeySpecifier is an NCName: (always an error)
&gt; 2.2 If KeySpecifier is an IntegerLiteral:
&gt; 2.3 If KeySpecifier is a ParenthesizedExpr:
&gt; 2.4 If KeySpecifier is a wildcard (&quot;*&quot;):
&gt; 3. Otherwise (error)

That&apos;s the approach I took.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>