[libxml-devel] Return value of XML::Node#<<

Mark Van Holstyn mvanholstyn at gmail.com
Sun Oct 29 17:19:00 EST 2006


I agree with this change. I think it would be one step to make the API a
little nice and more consistent.

Mark

On 10/29/06, Ross Bamford <rosco at roscopeco.co.uk> wrote:
>
> On Sun, 29 Oct 2006 13:56:17 -0000, Masashi Shimbo <shimbo at is.naist.jp>
> 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 - rosco at roscopeco.co.uk
> _______________________________________________
> libxml-devel mailing list
> libxml-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/libxml-devel
>



-- 
Mark Van Holstyn
mvette13 at gmail.com
http://lotswholetime.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/libxml-devel/attachments/20061029/aadbb1e3/attachment.html 


More information about the libxml-devel mailing list