RE: [F&O] Function for self-evaluation?

You may be aware that a number of XSLT implementations have a function like
this, and that it is included in the EXSLT library (www.exslt.org) under the
name dyn:evaluate().

The XSLT working group decided not to include such a function in the
standard. This is a shame in some ways because the function can indeed be
very useful. The reasons for the decision were: it is quite difficult to
specify it well, especially to define the static and dynamic context for the
function; it makes it difficult to separate the language compiler from the
run-time; it introduces significant complexities for typing. Also, I think
some people felt that it was likely to be used for situations where the
correct solution was higher-order functions (which are also not in this
version of the spec, and which some people feel are a higher priority than
dynamic evaluation).

Clearly there is nothing to stop implementors adding such functions under
their own namespace, or under a third-party namespace such as the one
allocated by the EXSLT group.

Michael Kay

> -----Original Message-----
> From: Sarah Wilkin [mailto:swilkin@apple.com] 
> Sent: 14 October 2003 00:58
> To: public-qt-comments@w3.org
> Subject: [F&O] Function for self-evaluation?
> 
> 
> 
> One function we added to our XQuery implementation is eval(), which 
> takes a string and evaluates it as an XQuery expression. I'm 
> wondering 
> if the working group has considered adding such a function.
> 
> The most obvious use case is a query that needs to be marked up and 
> executed later. For example, in the NIST test suite, a test 
> looks like:
> 	<results>
> 		{fn:boolean(xs:double("-1.7976931348623157E308"))}
> 	</results>
> So an implementor is somehow expected to read in the whole file and 
> execute it as XQuery. If eval is supported, the same file can become
> 	<results>
> 		fn:boolean(xs:double("-1.7976931348623157E308"))
> 	</results>
> And the test may be evaluated with XQuery itself:
> 	eval(doc("test.xml")/results/string())
> 
> There are, of course, many other uses. The is not merely a 
> "convenience 
> method" as it could never be written as a user-defined function. Any 
> comments are appreciated.
> 
> --Sarah
> 

Received on Tuesday, 14 October 2003 11:52:52 UTC