Re: Extension candidates
"Dimitre Novatchev" <[email protected]> Fri, 12 Dec 2008 06:20:16 -0800
| Newsgroups | gmane.text.xml.xslt.extensions |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Dec 12, 2008 at 4:26 AM, John Snelson <[email protected]> wrote: ................................ > I like the idea, and think it makes a lot of sense. I'm more than happy to > share the work I've already done on adding higher order functions to XQuery. > > There are a couple of issues I think we need to work out: > > 1) The work I've done on higher order functions adds syntax for addressing > named functions, as well as for lambda expressions with closures. I can see > how we could support the former just by defining extension functions, but > not the latter. > > 2) If we don't support higher order functions with closures, it's unclear to > me how we could use higher order functions to represent a sequence > reference. I don't know details of your implementation of HOF in XQuery, but in XSLT (FXSL) closures are implemented as partial (curried) applications. If the function f(x, y) is defined to have two arguments, then f(x) returns a new function g(y) of just one argument. g() needs to store internally the given value for x, and here is the moment when we need a reference to x. A copy of x is OK for atomic values, but may not be OK for nodes and sequences, containing not only atomic values. This is exactly the issue that was recently raised by Christoph Lange about currying with FXSL and it was quickly clear that this is not just an FXSL problem, but a problem with any potential implementation of higher-order functions. Dimitre