Discussion:
Compared to what?
(too old to reply)
Ihe Onwuka
2014-04-02 17:08:52 UTC
Permalink
The effort put into these specs is unequaled except for perhaps the effort to comprehend them in less time then they took to write :)
......especially when it is quicker to try out the thing you are
trying to verify.
Ihe Onwuka
2014-04-02 17:11:41 UTC
Permalink
Had to jump in here with a catcall ...
Does that mean I am now in the dog house?
Liam R E Quin
2014-04-02 17:53:21 UTC
Permalink
Excerpt from the 3.13 of the XQuery 3.0 specification.
[...]
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.
A little further down you'll see,
4. 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.

Liam
--
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml
David Lee
2014-04-02 17:12:09 UTC
Permalink
......especially when it is quicker to try out the thing you are trying to verify.
Thanks to Michael, the unofficial reference implementation (yea I know W3C doesn't do those),
is generally much easier to debug then the specs :)

----------------------------------------
David A. Lee
dlee-***@public.gmane.org
http://www.xmlsh.org
David Lee
2014-04-02 17:02:23 UTC
Permalink
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 :)


-----Original Message-----
From: talk-bounces-***@public.gmane.org [mailto:talk-bounces-***@public.gmane.org] On Behalf Of Ihe Onwuka
Sent: Wednesday, April 02, 2014 12:51 PM
To: Michael Kay
Cc: talk-***@public.gmane.org
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.
Michael Kay
Saxonica
_______________________________________________
talk-***@public.gmane.org
http://x-query.com/mailman/listinfo/talk
Ihe Onwuka
2014-04-02 16:51:10 UTC
Permalink
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.
Michael Kay
Saxonica
Michael Kay
2014-04-02 16:39:29 UTC
Permalink
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.
_______________________________________________
Not sure how you missed this, but it says this in great detail:

The resulting value is matched against each SwitchCaseOperand in turn until a match is found or the list is exhausted. The matching is performed as follows:

• 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.

Michael Kay
Saxonica
Ihe Onwuka
2014-04-02 16:13:52 UTC
Permalink
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.

Continue reading on narkive:
Loading...