From: mark hahn Date: 2001-11-22T08:23:35+09:00 Subject: [ruby-talk:26088] Re: string concat and .to_s > I frankly haven't tried running Ruby extensively with autoconversion turned on Oh! I didn't know there was such a feature. Is this in the pickaxe book? ----- Original Message ----- From: "Dave Thomas" To: "ruby-talk ML" Sent: Tuesday, November 20, 2001 8:34 PM Subject: [ruby-talk:25978] Re: string concat and .to_s > "Mark Hahn" writes: > > > I can give many concrete examples where I've used this feature of > > Java over the years. Can you give me a counter-example? > > Well, I guess I have three answers. > > One is that I frankly haven't tried running Ruby extensively with > autoconversion turned on - it might well work out OK. However, I > suspect it also might not. Matz has struck a delicate balance with > Ruby, and I tend to trust his judgment on these things. When it comes > down to it, that isn't really an answer, just an observation. > > The second is that Java does String concatenation as a special case. > > "fred" + 1 works > 1 + "fred" doesn't > String a = 99; doesn't > > In general, these kinds of things tend to complicate the language. You > could argue that by eliminating them, Ruby has oversimplified, but to > be honest I've never really felt the need for Java's behavior in Ruby. > > Third is a question of interpretation. You'd like "fred" + 1 to be > "fred1". How about "2" + 1? "21", or 3? There's a boat load of Perl > folks who'd argue for the latter. Which is right? Or should we have > both, depending on whether the string is a number or not? > > Regards > > > Dave > >