xsl-list
[Top] [All Lists]

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

2014-09-16 08:44:13
On 16 September 2014 14:58, Abel Braaksma (Exselt) abel(_at_)exselt(_dot_)net <
xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> 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


--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] Current Thread [Next in Thread>