[xquery-talk] Global variables in XQuery

Jonathan Robie jonathan.robie at datadirect.com
Wed Oct 4 12:51:23 PDT 2006


Liam Quin wrote:
> The "let" part of a FLWOR always creates new variables.
> Think of them as named constants if you prefer...
>   

This is the key point. Variables in XQuery never vary, they are 
constant. XQuery inherits this from other functional languages - but it 
does take some getting used to if you have been using procedural 
languages. On the plus side, it makes XQuery more declarative and 
optimizable.

FWIW, there is some work being done on procedural extensions to XQuery, 
which would allow the values of variables to be changed. But this is not 
part of the current language. For instance, see this paper:
http://www.ximep-2006.org/papers/Paper-Chamberlin-Carey.pdf

Jonathan

-- 
Read my Blog: http://blogs.datadirect.com/jonathan_robie/
Learn XQuery: http://media.datadirect.com/download/docs/ddxquery/tutorial_query.html
Learn XQJ (the JDBC for XQuery): http://www.datadirect.com/developer/xquery/topics/xqj_tutorial/
Get DataDirect XQuery: http://www.datadirect.com/products/xquery/




More information about the talk mailing list