Re: Predicates order of evaluation

Michael Kay <mike-JkSD5nQpfvpWk0Htik3J/[email protected]> Tue, 15 Sep 2020 19:06:56 +0100
Newsgroups gmane.text.xml.saxon.help
Message-ID <[email protected]>
As far as the spec is concerned, there are very few cases where order of evaluation is defined: the main case is conditional expressions (if A then B else C) where it's guaranteed that B won't be evaluated if A is false.

In Saxon, of course, the order is often predictable; but that doesn't mean it's guaranteed, or documented. But you can assume, for example, that Saxon won't evaluate sub-expressions in parallel except where it's explicitly documented that it does so. Which doesn't mean that this will never change in the future.

Your question about a[b] needs to be more specific. Is this an expression or a pattern? Do a and b represent arbitrary expressions, or is the expression literally a[b]?

With filter expressions, a lot depends on whether b is known to be a numeric expression independent of a, or a boolean expression dependent on a, or something else.

Michael Kay
Saxonica

> On 15 Sep 2020, at 16:21, Ihe Onwuka <[email protected]> wrote:
> 
> Just like to confirm. Is it the case that in 
> 
> In a[b]
> 
> the order of evaluation is unpredictable. So whereas evaluating b first might prevent a fatal error in a, you cannot rely on that evaluation order. 
> 
> Have I got that right?
> _______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/saxon-help

_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[email protected]
https://lists.sourceforge.net/lists/listinfo/saxon-help