Re: Defining and operating on types (Was: Re: Wh
Dimitre Novatchev wrote:
Mmh. Parentless nodes sound not so strange to me. I'm perfectly ok with parentless nodes like the following ;-):
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!
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format