Re: [xsl] Defining and operating on types (Was: Re: [xsl] Why no namespace node KindTest?)

Subject: Re: [xsl] Defining and operating on types (Was: Re: [xsl] Why no namespace node KindTest?)
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Sun, 27 Aug 2006 11:52:37 -0700
On 8/27/06, Florent Georges <darkman_spam@xxxxxxxx> wrote:
Dimitre Novatchev wrote:

Hi Florent,


 Mmh.  Parentless nodes sound not so strange to me.  I'm
perfectly ok with parentless nodes like the following ;-):

<f:makeComparison/>

   <f:curried>
     <fun>
       <f:makeComparison/>
     </fun>
     <arity>2</arity>
     <arg>
       <some-value/>
     </arg>
   </f:curried>



 It sounds logical to me that namespace nodes can be
parentless.  If a part of the program computes some nodes,
that will be added to a tree in an other part of the
program, and if this sub-tree rely on a particular prefix to
be bound to a particular URIs, it seems logical to return a
namespace node along the other nodes (if it can't be added
directly to the computed nodes).


I called them (and only the namespace parentless nodes!) strange, not illogical.

Leaving all philosophical reasoning aside, the essence of my post was:

 1. Proposal in a future XSLT spec (>= 3.0) that will allow
higher-order functions, to
     specify the value of the "as" attribute as a reference to the
constructor function for the
     type.

 2. In the meantime of approximately 6 years or so, for any
generic-type function that
     might be interested in manipulating the types of its arguments,
one way to pass both
     the argument and its type is using a tuple, consisting of the
constructor function for
     that type, followed by the actual arguments to the constructor,
from which to
     instantiate the value of the argument.

 3. Note that in this way we can define generic types -- types that
depend on other types
     for creating their instances. We will be able to specify and
manipulate generic type
     objects (whole directed graphs of them) which receive their, one
of many possible,
     concrete type at runtime .  Passing a type-constructor as an
argument is an
     extremely powerful design pattern!




-- Cheers, Dimitre Novatchev --------------------------------------- Truly great madness cannot be achieved without significant intelligence. --------------------------------------- To invent, you need a good imagination and a pile of junk

Current Thread