<?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>1754</bug_id>
          
          <creation_ts>2005-07-19 19:20:36 +0000</creation_ts>
          <short_desc>[FS] editorial: 7.2.1, 7.2.2, 7.2.10: normalizing calls to particular functions</short_desc>
          <delta_ts>2007-10-02 19:42:28 +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>Formal Semantics 1.0</component>
          <version>Last Call drafts</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>consider for 1.1</status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>minor</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Dyck">jmdyck</reporter>
          <assigned_to name="Michael Dyck">jmdyck</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>4918</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Dyck">jmdyck</who>
    <bug_when>2005-07-19 19:20:36 +0000</bug_when>
    <thetext>7.2.1 The fn:last context function
7.2.2 The fn:position context function
7.2.10 The fn:min, fn:max, fn:avg, and fn:sum functions

Norm
[[ fn:last()     ]]_Expr == ...
[[ fn:position() ]]_Expr == ...
[[ fn:sum()      ]]_Expr == ...
    These normalization rules can&apos;t be applied in the normal way. If &quot;fn&quot;
    is bound to a different namespace, you don&apos;t want the rule to fire.
    On the other hand, if the function is invoked via a different prefix
    or via the default function namespace, you *do* want the rule to fire.
    So you have to do some static analysis on the expression before you
    can decide whether or not to apply the normalization. I suppose you
    could make that fit into the processing model, but it might be easier
    to treat it much like any other built-in function, and provide STA and
    DEv.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>8960</commentid>
    <comment_count>1</comment_count>
    <who name="Jerome Simeon">simeon</who>
    <bug_when>2006-03-29 22:08:20 +0000</bug_when>
    <thetext>Fixed as suggested, relying on static and dynamic inference rules
instead of normalization.

- Jerome</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>12325</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Dyck">jmdyck</who>
    <bug_when>2006-10-05 23:08:24 +0000</bug_when>
    <thetext>In 7.2.1 and 7.2.2, the new STA rules look up fs:last and fs:position in statEnv.varType in order to get their type. But 3.1.2 tells us that &quot;the type of $fs:position and $fs:last is always xs:integer&quot;, so it seems you could make the STA rules simpler:
    ---------
    statEnv |- (FN-URI,&quot;last&quot;)() : xs:integer

    ---------
    statEnv |- (FN-URI,&quot;position&quot;)() : xs:integer

Moreover, this is exactly the conclusion one would draw by simply looking up fn:last or fn:position in statEnv.funcType. So given that section 7.2 is for functions &quot;for which the standard normalization or static typing rules are not appropriate&quot; and that &quot;the static typing rules in this section always give more precise type information than the generic rule based on the function&apos;s signature&quot;, it would appear that fn:last and fn:position don&apos;t belong in 7.2.
    

In the new DEv rules in 7.2.1 and 7.2.2, the conclusions
    dynEnv |- (FN-URI,&quot;last&quot;)() =&gt; Value
    dynEnv |- (FN-URI,&quot;position&quot;)() =&gt; Value
use an undeclared form.

Perhaps what you mean is
    dynEnv |- function (FN-URI,&quot;last&quot;) with types on values yields Value
    dynEnv |- function (FN-URI,&quot;position&quot;) with types on values yields Value</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13603</commentid>
    <comment_count>3</comment_count>
    <who name="Jerome Simeon">simeon</who>
    <bug_when>2007-01-16 18:00:25 +0000</bug_when>
    <thetext>I am reluctant to make substantive changes to that section at this
point. I merely fixed the dynamic rules as suggested to use the proper
judgment.

- Jerome
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>14100</commentid>
    <comment_count>4</comment_count>
    <who name="Jim Melton">jim.melton</who>
    <bug_when>2007-02-25 23:18:27 +0000</bug_when>
    <thetext>Closing bug because commenter has not objected to the resolution posted on 2007-01-16</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>15024</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Dyck">jmdyck</who>
    <bug_when>2007-05-06 08:59:50 +0000</bug_when>
    <thetext>In (7.2.1 and 7.2.2) / DEv / rule 1 / conclusion:
    dynEnv |- function (FN-URI,&quot;last&quot;)() with types on values yields Value
    dynEnv |- function (FN-URI,&quot;position&quot;)() with types on values yields Value
the &quot;()&quot; shouldn&apos;t be there.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>16995</commentid>
    <comment_count>6</comment_count>
    <who name="Michael Dyck">jmdyck</who>
    <bug_when>2007-10-02 19:42:07 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; it would appear that fn:last and fn:position don&apos;t belong in 7.2.

It&apos;s possible that sections 7.2.1 and 7.2.2 could simply be dropped without loss, but there doesn&apos;t seem to be a significant problem with leaving them in. I&apos;ll consider it for the 1.1 document, and have made a note in the Status Whiteboard to that effect.

(In reply to comment #5)
&gt; In (7.2.1 and 7.2.2) / DEv / rule 1 / conclusion:
&gt;     dynEnv |- function (FN-URI,&quot;last&quot;)() with types on values yields Value
&gt;     dynEnv |- function (FN-URI,&quot;position&quot;)() with types on values yields Value
&gt; the &quot;()&quot; shouldn&apos;t be there.

The extraneous &quot;()&quot; have been removed via the fix for FS erratum E013. This fix has been committed to the source files for the next edition of the FS document. Consequently, I&apos;m marking this issue resolved-FIXED, and CLOSED.

</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>