[xquery-talk] lazy evaluation of sequences
mike at saxonica.com
Fri Mar 14 08:12:48 PST 2014
On 14 Mar 2014, at 14:32, Ihe Onwuka <ihe.onwuka at gmail.com> wrote:
> Well (4,5 div 0) on Saxon gives 4. Hurray.
> (4,5 div 0) in eXist gives divide by zero error. Boo.
> So the answer seems to be it depends.
Correct, it's entirely implementation-dependent.
Saxon would fail on (4, 5 div 0, 6), but other products might return 6.
The rule (see the "Errors and Optimization" section of the spec) is (my precis) that a processor doesn't have to evaluate an expression if it doesn't need to know the value of that expression in order to deliver the final result, and in particular, it never needs to evaluate an expression merely in order to discover whether evaluating it throws an error.
More information about the talk