[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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

Subject: Re: [xsl] Seemingly incorrect example of function subtyping in XDM 3.0
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Wed, 26 Feb 2014 09:02:07 +0000

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

On 26 Feb 2014, at 05:45, Dimitre Novatchev <dnovatchev@xxxxxxxxx> wrote:

> In the W3C XDM 3.0 Proposed recommendation at the end of section:
> "2.8.1 Functions"
> the last example says:
>    "function(item()) as item() is a subtype of function(xs:string) as
> 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.

Current Thread