Had to jump in here with a catcall ...
"Miss something in a W3C spec ? Why ... the horror !!! or as George Takei (tm) says
'ohh myy' "
Tssk tssk ...
The effort put into these specs is unequaled except for perhaps the effort to comprehend them in less time then they took to write :)
From: email@example.com [mailto:firstname.lastname@example.org] On Behalf Of Ihe Onwuka
Sent: Wednesday, April 02, 2014 12:51 PM
To: Michael Kay
Subject: Re: [xquery-talk] Compared to what?
indeed.... how did I miss that..I'll tell you.. once I saw that a comparison was involved I was expecting to be declaratively told what type of comparison. Thats what I looked for and didn't see it.
I didn't expect to see an algorithm and didn't recognise what it was.
Excerpt from the 3.13 of the XQuery 3.0 specification.
"In a switch expression, the switch keyword is followed by an
expression enclosed in parentheses, called the switch operand
expression. This is the expression whose value is being compared."
The issue is the last word - compared.
XPath has general and value based comparisons and the spec doesn't
say what type of comparison is operative for comparisons on the
switch operand expression.
* The SwitchCaseOperand is evaluated.
* The resulting value is atomized.
* If the atomized sequence has length greater than one, a type error is raised [err:XPTY0004].
* The atomized value of the switch operand expression is compared with the atomized value of the SwitchCaseOperand using the fn:deep-equal function, with the default collation from the static context.
Using fn:deep-equal() on two atomic values is almost the same as using "eq", except that you get false rather than an error if the values are of incomparable types, and you get true if you compare NaN to NaN.