xsl-list
[Top] [All Lists]

Re: [xsl] () eq () vs () = ()

2011-09-30 10:37:03
>If () = () is false, then it's intuitive (to me) that deep-equal((), ()) is also false. The one liner saying that it should be true just seems like it could easily say false.

A = B means (some $a in A, $b in B satisfies $a eq $b). Therefore () = () is false.

deep-equal(A, B) means (count(A) eq count(B) and every $i in 1 to count(A) satisfies A[$i] eq B[$i]). Therefore deep-equal((), ()) is true.

So it's perfectly consistent. It's also absolutely necessary. Given that for two elements to be equal, their sequences of children have to be deep-equal, it would be very odd if two elements were not deep-equal simply because neither has any children. Indeed, it would be very odd if an element were not deep-equal to itself.

(Note, the above expansions are approximate. They don't quite handle NaN, but that's another can of worms.)

Michael Kay
Saxonica



--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>