On Sun, 29 Oct 2006 13:56:17 -0000, Masashi Shimbo <[EMAIL PROTECTED]> wrote:
> 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 agree. This does seem pretty inconsistent. > I'm not sure whether this is a big API change, but the current libxml > doc says nothing about the return value of <<. > If anything, I'd lean toward the opinion that this is 'probably a bug' in 0.3x and should be fixed. IMO this should be done in 0.4 though, in case any code is relying on the current behaviour. Any thoughts / objections? Cheers, -- Ross Bamford - [EMAIL PROTECTED] _______________________________________________ libxml-devel mailing list libxml-devel@rubyforge.org http://rubyforge.org/mailman/listinfo/libxml-devel