<?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>29683</bug_id>
          
          <creation_ts>2016-06-02 09:46:43 +0000</creation_ts>
          <short_desc>[XP31] Map lookup through function-call syntax does not explain what happens if the key does not exist</short_desc>
          <delta_ts>2016-07-20 13:58:45 +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>Member-only Editors Drafts</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>minor</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Abel Braaksma">abel.braaksma</reporter>
          <assigned_to name="Jonathan Robie">jonathan.robie</assigned_to>
          <cc>mike</cc>
          
          <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>126645</commentid>
    <comment_count>0</comment_count>
    <who name="Abel Braaksma">abel.braaksma</who>
    <bug_when>2016-06-02 09:46:43 +0000</bug_when>
    <thetext>Section 3.11.1.2 Map Lookup using Function Call Syntax in FO31 does not explain what happens if

1) the key does not exist (should it through an error, or behave like map:get?)
2) the key is not comparable using the collation (behave like map:get?)

Perhaps we should normatively link this section to the semantics of map:get, or conversely, move the semantics of map:get to this section and link back from map:get to this section.

Alternatively, using this syntax may raise an error for non-existing map keys, but I doubt that was the intend.

Note: sections 3.11.3.1 Unary Lookup and 3.11.3.2 Postfix Lookup do not seem to explain this either.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>126646</commentid>
    <comment_count>1</comment_count>
    <who name="Abel Braaksma">abel.braaksma</who>
    <bug_when>2016-06-02 10:06:15 +0000</bug_when>
    <thetext>Note, the example in FO31 section 17.5.3 fn:json-to-xml suggests that $m(x), where $m is a map, should return the empty sequence. Checking this code was what brought me to reporting this, as I had expected map:exists($c0chars, $char) in there somewhere.

This rule is implied from the lines with $replacement in the code below:

    ....
       let 
         $c0chars := map {
           &apos;\u0000&apos;:&apos;[NUL]&apos;,
           &apos;\u0001&apos;:&apos;[SOH]&apos;,
           &apos;\u0002&apos;:&apos;[STX]&apos;,
           ...
           &apos;\u001E&apos;:&apos;[RS]&apos;,
           &apos;\u001F&apos;:&apos;[US]&apos;
         },
         $replacement := $c0chars($char)
      return 
        if (exists($replacement))
    ....</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>126647</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-06-02 10:43:36 +0000</bug_when>
    <thetext>The reference in

Section 3.11.1.2 Map Lookup using Function Call Syntax in FO31

should be to 3.11.1.2 in *XP31*.

I agree that the semantics of $M($K) should be defined as equivalent to map:get($M, $K).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>126696</commentid>
    <comment_count>3</comment_count>
    <who name="Jonathan Robie">jonathan.robie</who>
    <bug_when>2016-06-07 15:22:03 +0000</bug_when>
    <thetext>(In reply to Michael Kay from comment #2)

&gt; I agree that the semantics of $M($K) should be defined as equivalent to
&gt; map:get($M, $K).

Yes.  And for arrays, $A($K) should be defined as array:get($A, $K).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>126765</commentid>
    <comment_count>4</comment_count>
    <who name="Jonathan Robie">jonathan.robie</who>
    <bug_when>2016-06-14 15:36:46 +0000</bug_when>
    <thetext>Resolved by accepting comment #2 and comment #3.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127006</commentid>
    <comment_count>5</comment_count>
    <who name="Abel Braaksma">abel.braaksma</who>
    <bug_when>2016-07-20 13:58:45 +0000</bug_when>
    <thetext>Checked, looks good, thanks.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>