xsl-list
[Top] [All Lists]

Re: [xsl] Seemingly incorrect example of function subtyping in XDM 3.0

2014-02-26 03:55:55
I think it's better to use term covariance.
It exaclty describes the effect.

See 
http://en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_science)
--
Vladimir Nesterovsky
http://www.nesterovsky-bros.com

-------- Original Message --------
From: "Michael Kay" <mike(_at_)saxonica(_dot_)com>
Sent: יום רביעי 26 פברואר 2014 11:22
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Seemingly incorrect example of function subtyping in XDM 
3.0

I believe the example is correct.

I find it useful to think of "substitutability" rather than subtyping.

If the requirement is for a function that accepts a string as an argument, 
then it's OK to supply a function that accepts any item as an argument. So 
function(item()) is substitutable for function(xs:string).

Michael Kay
Saxonica


On 26 Feb 2014, at 05:45, Dimitre Novatchev <dnovatchev(_at_)gmail(_dot_)com> 
wrote:

In the W3C XDM 3.0 Proposed recommendation at the end of section:
"2.8.1 Functions"  (http://www.w3.org/TR/xpath-datamodel-30/#function-items)

the last example says:

   "function(item()) as item() is a subtype of function(xs:string) as 
item()"

I believe that the correct statement is:


   "function(xs:string) as item()     is a subtype of
function(item()) as item() "

Could someone, please, confirm whether the example in the XDM 3.0 Spec
is correct, and if yes, then what is the chain of rules that leads to
this statement?


-- 
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
To avoid situations in which you might make mistakes may be the
biggest mistake of all
------------------------------------
Quality means doing it right when no one is looking.
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
To achieve the impossible dream, try going to sleep.
-------------------------------------
Facts do not cease to exist because they are ignored.
-------------------------------------
Typing monkeys will write all Shakespeare's works in 200yrs.Will they
write all patents, too? :)
-------------------------------------
I finally figured out the only reason to be alive is to enjoy it.

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


<Prev in Thread] Current Thread [Next in Thread>