This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 29686 - [xslt3.0] Imprecise language for rules on xsl:override
Summary: [xslt3.0] Imprecise language for rules on xsl:override
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XSLT 3.0 (show other bugs)
Version: Candidate Recommendation
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-04 15:54 UTC by Michael Kay
Modified: 2016-10-06 18:42 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2016-06-04 15:54:29 UTC
We say for xsl:override of functions, "The types of the arguments are pairwise identical....  The return types are identical."

It would be more precise to say what we mean by "the type of", e.g. to talk of "the declared type, defaulting to item()*"
Comment 1 Michael Kay 2016-06-09 16:23:34 UTC
Abel asks: does XPath have a definition of type equality, e.g. is union(A,B) identical to union(B,A)?
Comment 2 Michael Kay 2016-06-09 17:49:02 UTC
The answer to the question in comment #2 is that we do have a definition of "identical types" in 3.5.3.3:

[Definition: Types S and T are considered identical for the purpose of these rules if and only if subtype(S, T) and subtype(T, S) both hold, where the subtype relation is defined in Section 2.5.6.1 The judgement subtype(A, B) XP30.]

This rule means, for example, that union(double, decimal) is the same type as union(decimal, double).
Comment 3 Michael Kay 2016-06-09 22:15:49 UTC
The language has been tightened up a little:


<p>The <phrase diff="chg" at="T-bug29686">declared types of the arguments 
   (defaulting to <code>item()*</code>)</phrase> are pairwise <termref
    def="dt-identical-types">identical</termref>.</p>

<p>The <phrase diff="chg" at="T-bug29686">declared return types 
   (defaulting to <code>item()*</code>)</phrase> are 
   <termref def="dt-identical-types">identical</termref>.
Comment 4 Michael Kay 2016-06-16 16:21:52 UTC
Reopened because there was discussion about whether this definition of "identical" actually works - e.g. if untypedAtomic is supplied to union(double, decimal) the effect is different from when it's union(decimal, double).
Comment 5 Michael Kay 2016-06-24 13:03:30 UTC
I have added a test case override-f-031
Comment 6 Michael Kay 2016-06-27 07:55:59 UTC
The WG discussed this on 23 June 2016. I was given an action to add a note going into more detail about the consequences of the rule on "identical" types, which I have done as follows:

<p>
Consider a function that accepts an argument whose declared type is a union type with member types <code>xs:double</code> and <code>xs:decimal</code>, in that order (we might write this as <code>union(xs:double, xs:decimal)</code>). Using the same notation, this can be overridden by a function that declares the argument type as <code>union(xs:decimal, xs:double)</code>. This does not affect type checking: a a function call that passes the type checking rules with one signature will also pass the type checking rules with the other. It does however affect the way that the function conversion rules work: a call that passes the <code>xs:untypedAtomic</code> value <code>"93.7"</code> (or an untyped node with this as its string value) will be converted to an <code>xs:decimal</code> in one case and an <code>xs:double</code> in the other.
</p>
Comment 7 Michael Kay 2016-06-27 07:58:14 UTC
The WG discussed this on 23 June 2016. I was given an action to add a note going into more detail about the consequences of the rule on "identical" types, which I have done as follows:

<p>
Consider a function that accepts an argument whose declared type is a union type with member types <code>xs:double</code> and <code>xs:decimal</code>, in that order (we might write this as <code>union(xs:double, xs:decimal)</code>). Using the same notation, this can be overridden by a function that declares the argument type as <code>union(xs:decimal, xs:double)</code>. This does not affect type checking: a a function call that passes the type checking rules with one signature will also pass the type checking rules with the other. It does however affect the way that the function conversion rules work: a call that passes the <code>xs:untypedAtomic</code> value <code>"93.7"</code> (or an untyped node with this as its string value) will be converted to an <code>xs:decimal</code> in one case and an <code>xs:double</code> in the other.
</p>