I could at least understand this behavior being the case if we were adding "/bar" (although it'd still be non-intuitive). That URI throws away its current path makes it a tedious library. Net::HTTP expects it as an input, yet as you interact with URI, you are constantly massaging it into and out of string form.
In my opinion, URI should model the behavior of Pathname.
I have only done a few quick tests, but it seems that the '+' operator implements relative resolution (see http://tools.ietf.org/html/rfc3986#section-5.2). For URIs, this makes a lot of sense.
How very unintuitive :(. I guess the next question would be if URI.join actually needs to follow the merge rules to the letter, but I imagine that argument is moot :).
In my opinion, URI should model the behavior of Pathname.
I totally agree.
Additionally I absolutely dislike using global methods instead of class
factory methods. I think it isn't at all obvious and it poisons the
global namespace.
Changing the behavior of URI#+ from the current will break many libraries (including mechanize) that depend upon the current behavior of relative resolution.
The current behavior is frequently used to combine, for example, an anchor href with the current location to generate a new, correct URI if the href is a relative URI like "foo" or "../foo", a complete path like "/foo" or a complete URI like "http://other.example/bar".