Re: Tip?

Adam, you are right in that functional features of XPath 3.0 have rendered some former uses of dynamic evaluation superfluous.
By now the main justification for dynamic evaluation of expressions is "functional" input data, data providing expressions. It is interesting to note how much the very perception of this possibility (e.g. to allow configuration data to contain expressions, rather than only static data) is in line with the increasing interest in functional programming, with its core idea of treating units of behaviour as building blocks to be exchanged.
I think I understand what you mean, Liam. When transforming an input document into a query - generating the query, that is - removes the need for dynamic evaluation of expressions.
But this is not always feasible or desirable. An intermediate step of generating a query complicates the workflow, as you must introduce a controller process executing two queries (the generating one and the executing one) in succession. In general, a necessity to generate the evaluation of input data means a boundary to the scope of what can be done within a single XQuery or XSLT execution. And that is a serious matter from a strategic point of view, if we are interested in a growing scope of these phantastic, absurdly underestimated languages.

Generation is often out of the question when the expression is provided by interactive user input (e.g. command-line parameters). 

The security aspects mentioned by Adam are certainly a serious issue.
 

    Liam R. E. Quin <liam@w3.org> schrieb am 6:08 Sonntag, 28.August 2016:
 

 

On Sat, 2016-08-27 at 19:07 +0100, Adam Retter wrote:
> I have always been somewhat wary of `eval` although I cannot deny
> there are use cases for it. However, since higher-order-functions in
> XQuery 3.0 I find that many (but not all) of the cases in the past
> where I have seen eval used, could be replaced by function
> composition;

One of the most common remaining areas I've seen is where you want
XPath expressions as first class objects -- e.g. you're implementing
something like XSLT where there are XPath expressions embedded not in
the query but in an input XML document.

Translating the input document to a whole new query is sometimes a good
alternative.

Liam

-- 
Liam R. E. Quin <liam@w3.org>
The World Wide Web Consortium (W3C)


   

Received on Sunday, 28 August 2016 07:01:11 UTC