[XML-SIG] RE: Equality tests on DOM nodes

Fred L. Drake Fred L. Drake, Jr." <fdrake@acm.org
Mon, 14 Dec 1998 15:55:25 -0500 (EST)


John Cowan writes:
 > To be precise:  Fully general equality (fge) for mutable objects is
 > identity.  Fge for immutable objects is the fge-ness of their parts,
 > since indiscernable objects are identical (Leibniz's criterion).

  Leibniz?  Wow, and to think I actually know the name!  Shades of a
day long past!  (I first heard of Leibniz when I studied architecture, 
of all things!)
  I think this is just about where we've ended up on this one, but it
is definately stricter than is generally used for Python.  Typically,
two Python objects (let's take lists as an examples) are considered
equal if their contents are the same; equality of two objects is not
considered to be an unchangable characteristic.  If I have two lists:

	a = [1, 2]
	b = [1, 2]

they are considered equal now, but if I then do this:

	a.reverse()

they are no longer equal.  I think the biggest problem for doing this
with DOM nodes is the issue of context: if the parents are different,
the nodes should probably be considered different.
  Now, if I create two different nodes and insert equivalent data into 
each (say, character data nodes that contain equal data), I think they 
should compare equal.  The problem is that this is not the interesting 
case in practice.  What I *wanted* was less clearly a matter of
equality, and more a matter of a particularly strong correspondence.


  -Fred

--
Fred L. Drake, Jr.	     <fdrake@acm.org>
Corporation for National Research Initiatives
1895 Preston White Dr.	    Reston, VA  20191