From: Rick DeNatale Date: 2008-01-31T09:10:43+09:00 Subject: Re: ruby wish-list On 1/30/08, Chad Perrin wrote: > On Thu, Jan 31, 2008 at 04:34:49AM +0900, Roger Pack wrote: > > I know this is controversial, but I wish that if you did > > string_1 + object_2 (or any object) that it would just call .to_s on > > object_2 (instead of having to write it explicitly). I hate having to > > write extra .to_s's (even if it avoids ambiguity). That's just me, but > > hey :) > > > irb > irb(main):001:0> obj = Object.new > => # > irb(main):002:0> puts obj > # > => nil > irb(main):003:0> puts obj.to_s > # > => nil > > Seems like it already does what you want. What am I missing? Not that I necessarily agree with the OPs wish, but that wasn't his use case: irb(main):001:0> "abc" + 1 TypeError: can't convert Fixnum into String from (irb):1:in `+' from (irb):1 irb(main):002:0> "abc" + Object.new TypeError: can't convert Object into String from (irb):2:in `+' from (irb):2 -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/