[xquery-talk] flowrrr - how to structure a function?

Martin Probst martin at x-hive.com
Thu Oct 19 09:32:27 PDT 2006


> That's the kind of use case that the scripting extension of XQuery
> (XQueryP) that Jonathan was mentioning here is supposed to solve.
> This is not an isolated use case, that's a more and more frequent use
> case scenario, and the current XQuery 1.0, nor the Update spec do
>  no good for it.

I think it should be possible to rewrite those functions in a way  
that makes them if not side-effect free at least idempotent. If you  
then have later functions depend on input values from earlier  
functions you should be safe. E.g. session:invalidate() should be  
session:invalidate($session-token) and session:begin() should return  
that $session-token. I'd say it's probably worth the effort.

> The scripting extension of XQuery should help though, it applies the
> side-effects right away and guarantees a deterministic evaluation  
> order
> for subexpressions with side-effects (among other things).

I'm not sure it's possible to do so in every use case, and especially  
if it's also elegant to do so, so there might be a case for XQueryP.


Martin Probst
X-Hive Corporation
martin at x-hive.com

More information about the talk mailing list