At 2011-09-30 11:48 +0100, Andrew Welch wrote:
On 30 September 2011 10:54, Stefan Krause <stf(_at_)snafu(_dot_)de> wrote:
> To make the confusion complete, deep-equals((),()) returns
true(), which is IMHO the most expected behavior.
heh so
() = () returns false
deep-equals((),()) returns true
That's interesting, I'm guessing it has to be a 'just because'
reason... unless its because, ahem, deep down everything is equal :)
:{)}
Fwiw, it applies to the other comparison operators too, eg () > ()
returns false, () ge () returns ().
Ummmmm ... if either operand of *any* symbol comparison is the empty
set the result returned is false() because the result is initialized
to false() before determining any of the individual comparisons. It
then finds there are none, so there is nothing to do.
And XPath 2 3.5.1(2) dictates very similarly that if either operand
is the empty sequence the result returned is the empty sequence
without doing any other work. And if you convert the empty sequence
to a Boolean you end up with false() as well.
And the very first bullet of Functions 15.3.1 for deep-equal() reads
"If the two sequences are both empty, the function returns true."
Does all that qualify as "just because"? At least it is well
defined. As a user I like the fact that such behaviours are
well-defined ... I'm sure developers must appreciate that as well.
I'm trying to understand where your frustration with the
specification or the behaviours lies.
Thanks!
. . . . . . . . . Ken
--
Contact us for world-wide XML consulting and instructor-led training
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
G. Ken Holman mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--