Re: [xsl] Re: XPath 2.0: Problems with the two boolean constants true and false

Subject: Re: [xsl] Re: XPath 2.0: Problems with the two boolean constants true and false
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 9 Oct 2003 13:18:19 +0100
Hi Mike,

>> The problem is that the boolean value produced by the template is
>> assigned to an untyped variable (because the instantiating code is
>> generic and cannot know the type of values produced by the template
>> it instantiates).
> This is the bit that I don't understand. You must know something
> about the values produced by the code you are calling, otherwise the
> result is meaningless to the caller. What isn't clear to me (though
> Jeni seems to have divined it in her usual way...) is what kind of
> contract you want to have between the calling code and the called
> code. Usually this contract is expressed in terms of types; if you
> want to express it some other way, then I would like to understand
> that.

As I think you know, many of the generic templates that Dimitre uses
in FXSL have "functions" as parameters. For example, the "map"
function takes a sequence and a function as parameters, and returns
the sequence constructed by applying the function on each of the items
in the sequence.

In these templates, you don't need to know what the function actually
*does*, and therefore don't need to know what types of parameters it
expects (as long as you know *how many* parameters it expects, I

For example, you could imagine a kind of 'join' function that takes
two sequences plus a two-argument function and returns a single
sequence that is the result of applying the function on each pair of
values from the two sequences. This would work with the 'and' function
(which expects two booleans) or a 'plus' function (which expects two

If you call the 'join' function directly, you know statically that the
two sequences have to be booleans (or numbers) and that the result is
a sequence of booleans (or numbers), based on the function that you
pass to the 'join' function. So as a programmer using the function of
course you know what it does. However, the implementation of the
'join' function is completely generic and it can't tell the types of
the arguments or result of the function that it's passed (since we
don't have reflection).



Jeni Tennison

 XSL-List info and archive:

Current Thread