Hello,

I noticed that libxml-ruby 0.3.8's method XML::Node#<<(child)
returns 'child' instead of 'self'.

This is inconsistent with the typical behavior one would expect from the
<< operator; '<<' for Array, IO, and Set all return 'self', which makes
it easy to add multiple elements with a one-liner like 

  parent << child1 << child2 << child3

However, if 'parent' is an XML::Node, 'child2' will be its grandchild
instead of its second child.

Wouldn't it be better to change the behavior of XML::Node#<< to follow
the convention and return 'self'?

I'm not sure whether this is a big API change, but the current libxml
doc says nothing about the return value of <<.

Regards,

Masashi Shimbo

_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to