[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Is the semantics of the "or" operator implementation-dependent?


Subject: Re: [xsl] Is the semantics of the "or" operator implementation-dependent?
From: "Wolfgang Laun wolfgang.laun@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 16 Sep 2014 13:43:58 -0000

On 16 September 2014 14:58, Abel Braaksma (Exselt) abel@xxxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:


> >
> > Is the semantics of the "or" operator implementation-dependent?
> >
>
> No, the semantics not, the order of execution is, however, which means
> that in error-cases, you can have different outcomes between processors.
> This is not different from other languages, in C#, F#, Java, C++ similar
> forms of optimization exist.
>
> Considering '15.7 in the Java Language Specification: Do you have an
actual example/experience of some Java expression (logical "or") where
different outcomes between processors have been observed?



> If you want to deterministically throw an error, use a more predictable
> way of writing. I don't think I have ever come across a C++ style of code
> like this (and even if you see it, it is considered code smell):
>
> return a || functionThrowingException()
>
> Instead, people tend to write:
>
> return a ? a : functionThrowingException()
>

Even so, many a QA would not tolerate the required function.

-W

>
> which is the equivalence of the if-then syntax in XPath.
>
> Cheers,
>
> Abel Braaksma
> Exselt XSLT 3.0 streaming processor
> http://exselt.net


Current Thread
Keywords