Re: Extension candidates
"Michael Kay" <[email protected]> Fri, 12 Dec 2008 11:07:34 -0000
| Newsgroups | gmane.text.xml.xslt.extensions |
|---|---|
| Message-ID | <548937D222A24781A1BE3BCDFE7CCC6B@Sealion> |
> > Let me ask a question that no one on the XQuery WG has yet > been able to answer compellingly: why do you need node > references if you have sequences of sequences (or some other > more complex structure)? I'd like to suggest we think of a first-class function as our basic building block: a third kind of item. Then we can have a function ref($node) that returns an anonymous zero-argument function which, when called, yields $node. So we have node references as an almost-primitive value; they look primitive, but actually ride on the back of higher-order functions. Whether the reference can be strongly typed depends on whether higher-order functions can be strongly typed; I suggest we go for weak typing for the moment, as we're trying to implement this in terms of extensions. We can easily generalize ref() so the argument is any sequence, not just a node. Since a function is an item, a reference is an item, and can therefore be part of a sequence. So we have nested sequences (of a kind). We can then think about what operators we might want over nested sequences. So I'm inclined to build "nested sequences" from references as the primitive. Michael Kay