Re: Reference and First-Class Function

"Vladimir Nesterovsky" <[email protected]> Fri, 19 Dec 2008 21:35:05 +0200
Newsgroups gmane.text.xml.xslt.extensions
Message-ID <[email protected]>
John,

I've read you proposal. It looks consistent.
Rather lengthy to my taste.
I would remove everything except function
types and inline functions, and titled proposal "... XPath".

I would possibly added typedefs to shorten type names.

In fact I would be satisfied if such feature found its way to the next spec.

The question is to WG people (Michael Kay?): shall we see something like 
this in spec?

P.S. I know only one other WG that is more thorough in their work: C++ WG.
--
Vladimir Nesterovsky
http://www.nesterovsky-bros.com

> Vladimir Nesterovsky wrote:
>>> o Higher order function support would be good to have.
>>> o Sequence references would be good to have.
>>> o Since HOF closures look a lot like sequence references, if we're going 
>>> to have both we should implement one in terms of the other.
>>
>> I think it's rather untrivial to implement refereneces in terms
>> of higher order functions through extension functions and extension 
>> objects only.
>>
>> If there were inline functions that would be a copletely different thing.
>>
>> If I'm wrong, can you please show an example of an expression using such 
>> extensions.
>
> Here's how I'd declare it in XQuery without using inline functions:
>
> declare function ex:identity($x)
> {
>   $x
> };
>
> declare function ex:ref($x)
> {
>   ex:partial-apply(ex:function("ex:identity", 1), $x)
> };
>
> declare function ex:deref($r)
> {
>   ex:call($r)
> };