Changes

Jump to navigation Jump to search
985 bytes added ,  15:30, 26 January 2015
no edit summary
local:max(2, 3)
</pre>
 
Since {{Version|8.0}} of BaseX, the following implementation-defined annotations are available:
 
* {{Code|%basex:inline}} enforces the inlining of a function. Example:
 
'''Example:'''
<pre class="brush:xquery">
declare option db:inlinelimit '0';
declare %basex:inline function local:id($x) { $x };
local:id(123)
</pre>
 
In the optimized query, the function will be inlined and further optimized, although the global inline limit was set to 0:
 
'''Optimized query:'''
123
</pre>
 
* {{Code|%basex:lazy}} enforces the lazy evaluation of a global variable. Example:
 
'''Example:'''
<pre class="brush:xquery">
declare %basex:lazy variable $january := doc('does-not-exist');
if(month-from-date(current-date()) == 1) then $january else ()
</pre>
 
The annotation ensures that an error will only be thrown if the condition yields true. Without the annotation, the error will always be thrown, because the referenced document is not found.
==Functions==
=Changelog=
 
;Version 8.0
 
* Added: %basex:inline, %basex:lazy
;Version 7.7
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu