Hm, well, thats because of the shortcut behavior in Pathname#+ which
tests that the argument is absolute. I'll fix that and see if thats
done other places and change them to create new instances from
self.class.



On 3/27/06, Tanaka Akira <akr / m17n.org> wrote:
> In article <87fyl3x0wd.fsf / m17n.org>,
>   Tanaka Akira <akr / m17n.org> writes:
>
> > The class of an argument may be different from
> > self.class.new.
> >
> > For example, if P inherits Pathname,
> > Pathname.new("...") + P.new("...") returns an instance of
> > Pathname.
>
> Oops.  It was wrong.  It may return an instance of P.
>
> % ./ruby -Ilib -rpathname -e '
> class P1 < Pathname; end
> class P2 < Pathname; end
> p P1.new("a") + P2.new("b")
> p P1.new("a") + P2.new("/b")
> '
> #<P1:a/b>
> #<P2:/b>
>
> I think it is inconsistent.
> --
> Tanaka Akira
>
>


--
When I do good, I feel good;  when I do bad, I feel bad,
and that is my religion.
    -- Abraham Lincoln (1809 - 1865)