xsl-list
[Top] [All Lists]

Re: [xsl] getting type information in xslt 2.0

2006-10-24 07:46:15
On 10/24/06, David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:

> Very briefly, all the functions in your example are typeless.

Not sure what you mean by typeless in this context?

The actual examples certainly have holes in them, it was just some very
late night doodling in response to you "how" question:-) But I'm not
sure that you ever _have_ to save data in xslt2 as element content do
you (which is I think where you are losing type information) unless you
need to serialise to an XML output. If you can hold the data in memory
as XPath sequences, you should be able to retain type information?

Oh do you mean you need to define separate functions for separate types
rather than rely, as I did, on the inbuilt polymorphism of the build in
F&O functions and operators? In that case yes you do need to get type
information but in that case it's not to do with the requirments of
partial function application, just getting round the limitation that
XPath2 signatures for user-functions have to be distinguished by arity
not type.

David


--~------------------------------------------------------------------
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>
--~--


Actually. it is quite clear.

If a function has two arguments, the first an xs:date and the second
an xs:integer,

and the function that creates the partial application accepts one
argument, it must accept only an xs:date -- not an argument of another
type.

Failing to do so will postpone the error message until "late-runtime"
instead of compile time and this is too-much to lose.

I will write more on this when I have more time -- in the meantime
maybe both Colin and Florent could explain.

The main thing is FXSL supports static type-checking of arguments (and
function return types).  A partial application is implemented as a
structure (xml element) encoding the function with N arguments and k <
N argument values. It may be interpreted (invoked) at any time in the
future bu providing some or all of the remaining arguments.

Any time a new argument value is provided, it must be of the type the
original function accepts for this (Kth) argument -- this must be
checked at the time this arg. value is provided -- not at the final
when the original function is invoked with all N argument values.

All this requires that a partial application knows the number and
types of all the arguments of the original function.

--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play

--~------------------------------------------------------------------
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>
--~--