Robert Klemme <shortcutter / googlemail.com> wrote:

> On Wed, Sep 12, 2012 at 5:15 PM, Matt Neuburg <matt / tidbits.com> wrote:
> > Just getting started experimenting with Ruby 1.9 (1.9.3) and my scripts
> > are collapsing about my ears - for various reasons, of course, but one
> > of them turns out be that my code relies heavily on implicit conversion
> > of Pathname to String in various string contexts. It seems that Pathname
> > no longer has to_str. My questions are:
> >
> > (1) Why? Was this regarded as a security issue? Or has it, perhaps,
> > something to do with encodings? I can see the change happening here:
> >
> > <https://github.com/shyouhei/ruby/commit/4ded52b623ebd1b3de12db82f8b54cc
> > 156c1fd28>
> >
> > But I don't understand the reasons for it - and especially why they
> > would do this when it causes so much breakage.
> 
> I interpret "path object is not a string." to mean that a Pathname is
> not generally considered equivalent to a String.

Except that it is. From the core methods section of the Pathname
documentation: "These methods are effectively manipulating a String,
because that's all a path is."

The use cases are like this:

require "pathname"
f = Pathname("howdy")
p ("well " + f)

Under 1.8.7 that's "well howdy". Under 1.9.3 it's an error, "can't
convert Pathname into String." One wants to say: "Sure you can, just
call to_s like you used to!"

It's the breakage I don't understand. Why do our Benevolent Masters
think this is just okay? I'll never find all the code where I'm doing
this sort of thing... m.

-- 
matt neuburg, phd = matt / tidbits.com <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings