<?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>1755</bug_id>
          
          <creation_ts>2005-07-19 20:55:16 +0000</creation_ts>
          <short_desc>[FS] technical: 7.2 Standard functions with specific typing rules</short_desc>
          <delta_ts>2005-09-06 13:15:14 +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></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Dyck">jmdyck</reporter>
          <assigned_to name="Jerome Simeon">simeon</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>4923</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Dyck">jmdyck</who>
    <bug_when>2005-07-19 20:55:16 +0000</bug_when>
    <thetext>7.2 Standard functions with specific typing rules

It occurs to me that none of the inference rules in this section can be
applied in the normal way. E.g., if you have a FunctionCall of the form
    fn:remove($a,$b)
you can&apos;t just apply 7.2.11 (even though the FunctionCall matches the
rule&apos;s conclusion), because &apos;fn&apos; might be bound to a different namespace.
Moreover, if you have FunctionCalls such as
    func:remove($a,$b)   or   remove($a,$b)
then if &apos;func&apos; is bound appropriately, or the default function namespace
is set appropriately, you *do* want to apply 7.2.11, even though the calls
do *not* match the rule&apos;s conclusion.  This is a fair bit of fudging to
impose on the inference process.

One way to avoid the fudging would be to tweak each function to properly
check the function name. E.g., change each rule of the (rough) form:

    statEnv |- Expr : Type
    ----------------------
    statEnv |- fn:foo(Expr) : something(Type)

to (something like):

    QName of func expands to (URI,NCName)
    URI = &quot;http://www.w3.org/2005/04/xpath-functions&quot;
    NCName = &apos;foo&apos;
    statEnv |- Expr : Type
    ----------------------
    statEnv |- QName(Expr) : something(Type)

Then the normal inference process would cause the rule to match in exactly
those cases that you want it to match.

However, that would be a pain. Here&apos;s (what I think is) a much better
solution. Currently, the rule-conclusions are judgments of the form

    statEnv |- QName (Expr1,...,Exprn) : Type

and thus are (apparently) alternatives to 4.1.5 / STA / rule 1. Instead,
make then judgments of the form

    statEnv |- expanded-QName(Type1,...,Typen) : Type

(See Bug 1575.) So rather than being alternatives to 4.1.5 / STA / rule 1,
they would be invoked *by* it, after it&apos;s already expanded QName (and
typed the arguments).  So now the rules would be alternatives to
4.1.5 / STA / rule (2|3).

Roughly speaking, you would need to change each rule from:

    statEnv |- Expr : Type
    ----------------------
    statEnv |- fn:foo(Expr) : something(Type)

to:

    URI = &quot;http://www.w3.org/2005/04/xpath-functions&quot;
    NCName = &apos;foo&apos;
    ----------------------
    statEnv |- (URI,NCName)(Type) : something(Type)

or, with suitably-defined shorthand, to just:

    ----------------------
    statEnv |- (FN-URI,&apos;foo&apos;)(Type) : something(Type)

(which is even more concise than the current, since it doesn&apos;t need
premises to get the types of the arguments).

I think this would work fine for all the functions in 7.2 except for
fn:collection and fn:doc, whose STA depends on the *form* of the argument,
not just its type. For those two, I suppose you could use the first
solution I suggested.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4948</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Dyck">jmdyck</who>
    <bug_when>2005-07-19 23:25:14 +0000</bug_when>
    <thetext>(In reply to comment #0)
&gt;
&gt; I think this would work fine for all the functions in 7.2 except for
&gt; fn:collection and fn:doc, whose STA depends on the *form* of the argument,
&gt; not just its type.

Oh, and fn:subsequence.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>5253</commentid>
    <comment_count>2</comment_count>
    <who name="Jerome Simeon">simeon</who>
    <bug_when>2005-07-27 15:22:45 +0000</bug_when>
    <thetext>
I agree with the second proposed fix, beginning
&quot;However, that would be a pain. Here&apos;s (what I think is) a much better
solution. Currently, the rule-conclusions are judgments of the form...&quot;


</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>5612</commentid>
    <comment_count>3</comment_count>
    <who name="Jerome Simeon">simeon</who>
    <bug_when>2005-08-31 15:32:03 +0000</bug_when>
    <thetext>The XML Query and XSLT WGs have accepted the bug, with the second proposed fix.
- Jerome
</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>