[libxml-devel] Changing node equality

Dan Janowski danj at 3skel.com
Mon Jul 7 17:45:08 EDT 2008


I think this is a vestige of the old fact that there could be two ruby  
objects that referred to the same XML node. Since I removed that and  
now there is only a one-to-one relationship between the ruby peer and  
the XML node, if == is equivalent to equal? and equal? is object  
identity, then it makes sense to do as you say. Should eql? take on  
the code of the current ==?

Dan


On Jul 7, 2008, at 03:18, Charlie Savage wrote:
> This bug report is interesting:
>
> http://rubyforge.org/tracker/index.php?func=detail&aid=19772&group_id=494&atid=1971
>
> Basically, the code compares two nodes using the == operator,  
> assuming that == means equal? (same object) and not eql? (equivalent  
> object).
>
> Right now libxml-ruby does the opposite by defining eql? (and thus  
> ==) to be the comparison of two different node's raw xml (as a  
> string). Needless to say, that can be an extremely slow operation  
> for large documents.
>
> In addition, I can't see how libxml-ruby's interpretation is even  
> useful - why would you want to compare if two node's raw xml is the  
> same?  For point of comparison, it looks like rexml does not  
> override eql?
>
> So, I'd like to change the libxml bindings by removing the  
> overridden == operator, thus making == mean equal?
>
> Objections?
>
> Charlie
> _______________________________________________
> libxml-devel mailing list
> libxml-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/libxml-devel



More information about the libxml-devel mailing list