Re: node equality: fn:node-equal()

Michael Rys wrote:

> How do you define node equality?


Just as fn:deep-equal() already does, without recursing down the tree, I 
would think.

> The whole reason for fn:deep-equal() is to
> provide the most common from of node equality.


But if I want to test two nodes for equality, and they have five 
thousand children, then using fn:deep-equal() would do 5001 comparisons 
instead of one (where one comparison includes attributes etc).

> Any other form in my
> opinion should be written by the user him-/herself.


As I said, I could do it by testing various aspects of the pair, thus 
writing my:node-equal(), but I'd prefer to have it available in the 
language.

Comparing two nodes for equality is even more basic, general, and useful 
as is fn:deep-equal(). I could write a lot myself, but I also could 
design and implement the whole lang myself.

> Having a
> proliferation of equality functions in the spec seems not appropriate
> (as David C. pointed out).


I think something like a standard library could be a good idea (see 
David's posts): A small language with a sufficiently comprehensive 
library of utility functions (etc).

Tobi

-- 
http://www.pinkjuice.com/

Received on Wednesday, 14 May 2003 03:55:31 UTC