RE: appeal for fn:match and fn:apply

This isn't an official response, jsut a personal one.

Generally, the WGs aren't disposed to consider requests for new features at
the moment. We want to get the current releases of the languages finished,
and the only way to do this is to stop adding things.

The functionality of your fn:match is a subset of what can be achieved by
xsl:analyze-string in XSLT 2.0. XQuery WG decided that this level of
capability went beyond what was needed in XQuery 1.0. I think most use cases
for this kind of functionality require the construction of new elements to
contain matched substrings, which your design does not readily allow.

Your fn:apply is a simple (in fact, simplistic) solution to the need for
higher-order functions. The WGs have decided not to do higher-order
functions this time around because of the complexity involved in getting
them to work in a way that doesn't break the type system. I think you'll
find that a majority of the WG is opposed to a solution like this that might
meet 80% of the requirement, but is essentially slipping in a fundamental
language feature by the back door.

Michael Kay 

> -----Original Message-----
> From: public-qt-comments-request@w3.org 
> [mailto:public-qt-comments-request@w3.org] On Behalf Of Mark 
> D. Anderson
> Sent: 16 August 2004 04:11
> To: public-qt-comments@w3.org
> Subject: appeal for fn:match and fn:apply
> 
> 
> Two functions that I'd like to see added to xquery operators are:
> 
>   fn:match($input as xs:string?, $pattern as xs:string,   $flags as
>   xs:string) as xs:string*
>   fn:match($input as xs:string?, $pattern as xs:string) as xs:string*
> 
> The function fn:match supports capturing parentheses:
> 
>   fn:match("alpha/beta/gamma", "^(\w*).*(\w*)$") returns ("alpha",
>   "gamma")
> 
> It the entire pattern does not match, then it returns the empty
> sequence.
> 
>    fn:apply($funcname as xs:QName, $args as xs:anyType*) as 
> xs:anyType*
> 
> The function fn:apply allows calling a function whose name may not be
> known statically, for example based on input.
> 
>    let $f1 := 'fn:sum';
>    let $call := <fn:sum><arg1>1</arg1><arg2>2</arg2></fn:sum>
> 
>    fn:apply($f1, (1, 2))
>    fn:apply(fn:name($f1), $call/text())
> 
> The function fn:apply does not allow for arguments which are 
> themselves
> sequences, since nested sequences are not allowed in XQuery.
> 
> An alternative would be fn:call with versions for any arity:
> fn:call($funcname as xs:QName) as xs:anyType*
> fn:call($funcname as xs:QName, $arg1 as xs:anyType*) as xs:anyType*
> fn:call($funcname as xs:QName, $arg1 as xs:anyType*, $arg2 as
> xs:anyType*) as xs:anyType*
> ....
> 
> -mda
> 
> 
> 

Received on Monday, 16 August 2004 13:40:47 UTC