Re: ISSUE: Why no higher-order functions?

Hi Shawn,

This is a reasonable request, especially since XQuery itself needs the 
functionality of a higher order function for sorting, and it would be very 
helpful to have this for distinct.

Unfortunately, designing a general and optimizable approach to higher order 
functions will take some time. I think it is unlikely that Working Group 
members would be willing to delay XQuery 1.0 in order to provide them. 
There is some interest in higher order functions on the Working Group, but 
I think the most likely scenario is that we would delay this to Level 2.0.

In general, the Working Group is most easily persuaded by compelling use 
cases that display queries that can not be easily written without the 
feature. You may want to consider writing such queries if you want to push 
your case further.

Jonathan

These are my opinions right now. They may be quite different from the 
opinions of Software AG, the W3C XML Query Working Group, or the opinions 
that I will have after reading and considering your response.

At 10:36 AM 1/14/2002 -0500, Shawn Vincent wrote:

>Summary: Please add higher-order functions.
>
>
>XQuery is a functional language.  Most functional languages have
>higher-order functions (functions that can be stored in variables, and
>passed as arguments to other functions), and these provide a powerful
>mechanism for abstraction and expression that is nearly impossible to
>get otherwise.
>
>Many functions I would like to write demonstrate the need.  For
>example, if I wanted to write a sort() function as an XQuery library,
>I would not be able to parameterize it using a comparison function.
>Thus, I'd need to re-write the entire sort() function for every
>datatype I wanted to sort.  This seems unreasonable.
>
>
>The syntax for XQuery demonstrates the need.  Many of the syntactic
>constructs in XQuery could more pleasantly and easily be done with the
>addition of higher-order functions.  'sortby', 'some', and 'every'
>expressions spring to mind immediately.  In addition, if I wanted to
>write new, similar functionality, I'd be out of luck.  Adding new
>syntax for each slight variant of a mechanism seems overkill.
>
>
>The community seems to recognize the need.  Also, witness the fact
>that shortly after XSLT was released, the need for higher-order
>functions was seen as useful enough to be integrated into Saxon as
>well as into the EXSLT spec.  So there's user demand.
>
>
>In summary, the lack of higher-order functions seems a crippling
>disability to XQuery, and there is much need, as demonstrated by use
>cases, the XQuery syntax itself, and the community.  Please consider
>adding higher-order functions to XQuery.
>
>
>Thank you for your time.
>
>       -Shawn Vincent.
>
>
>
>--
>Shawn Vincent, svincent@exalt.com
>Exalt Inc.

Received on Thursday, 24 January 2002 09:43:31 UTC