2008-12-06 20:53:13 UTC
Dear fellows,
That's a very interesting subject (thanks Dimitre for the reminder
on the mailing list, I thought I should receive a notification, as I
actually monitor the forum, but I didn't; weird...)
I have another way in mind, though, to solve that problem, that
would also be effecient and even more general: the ability to have
nested sequences. That reminds me to ask about this for XSLT 2.1;
thanks ;-)
Because we already have a way to refer to nodes: as an item in a
sequence. The reason it is not usable for currying is because we want
to create a single one item to identify the curried function. If we
return a sequence, we wouldn't be able to use it in another sequence,
as it would then be atomized.
So we are stuck: either we put the node in an XML structure (as it
is done for now) and then it is copied (or at least that is as if it
was) or we return just the node but then, we can't return currying
information... So as you said, we have to rely on extensions here.
With nested sequences, we could simply return such a sequence (like
a regular sequence, but that would never been automatically atomized,)
with the currying info and then the curried items. I had such an
implementation for Saxon for years, but it was on the laptop that one
stole to me :-( But the idea was more or less to have a tiny proxy
object in Java that stands for a whole sequence, and an XSLT module
that encapsulate the creation of this object from a sequence and to
get the sequence back from this object.
I think this kind of sequences would help in currying implementation
(and help solving the problem currently discussed,) as well as being
more general and usable in other contexts.
What do you think? I could try to write again a PoC for this...
Regards,
--
Florent Georges
http://www.fgeorges.org/