From: Mark Hahn Date: 2001-12-11T22:29:58+09:00 Subject: [ruby-talk:28212] Re: The benefits of dynamic typing? I'm not familiar with to_str. I'll check it out. I would expect "1" + [2] ==> "1[2]", not "12". -----Original Message----- From: ts [mailto:decoux@moulon.inra.fr] Sent: Tuesday, December 11, 2001 5:11 AM To: ruby-talk ML Cc: ruby-talk@ruby-lang.org Subject: [ruby-talk:28209] Re: The benefits of dynamic typing? >>>>> "M" == Mark Hahn writes: M> Recently, I lost an argument to several people in the community on this M> mailing list. I was proposing that string concatenation should work with M> any object. So "1" + 1 ==> "11". This is how Java works. I found it very M> useful and used it constantly. I use it right now in ruby constantly (but I M> have to add .to_s all over the place). Well, if you *REALLY* *REALLY* use it constantly then you can write pigeon% cat b.rb #!/usr/bin/ruby class Object def to_str to_s end end p ("1" + 2) p ("1" + [2]) pigeon% pigeon% b.rb "12" "12" pigeon% Be carefull with this ... Guy Decoux