Re: Tip?

> On 25 Aug 2016, at 12:50, Adam Retter <adam@exist-db.org> wrote:
> 
> So... the way I would explain it for eXist is, that the util:eval
> function example that I gave, executes code within the current XQuery
> Context, so everything in the host XQuery is available to the
> dynamically evaluated query. We also have a version of util:eval where
> you can request a new context if you wanted isolation.
> 

By contrast, saxon:evaluate() has always allowed access to user-defined functions declared in the query, but not to variables. Historically this was because variables were often optimized away during compilation, therefore not available at run-time, and we didn't want to forgo this optimization opportunity just because someone might do an eval() to access the variables at run-time. In principle the same argument could apply to functions, once we started doing function inlining; but we have to preserve functions for fn:function-lookup anyway.

Michael Kay
Saxonica

Received on Thursday, 25 August 2016 12:07:27 UTC