From: "David A. Black" Date: 2005-01-20T00:19:13+09:00 Subject: Re: value by reference Hi -- On Thu, 20 Jan 2005, Michel Martens wrote: > It's easy to accomplish this task with strings: > > def do_something(a, b, c) > a.replace((a.to_i + 1).to_s) > b.replace((b.to_i + 2).to_s) > c.replace((c.to_i + 3).to_s) > end > > a, b, c = '5', '6', '7' > do_something(a, b, c) > > It would be nice to have a replace method for every object, then we could write: > > def do_something(a, b, c) > a.replace(a + 1) > b.replace(b + 2) > c.replace(c + 3) > end > > a, b, c = 5, 6, 7 > do_something(a, b, c) What would you replace 5 with? :-) (Remember, you're sending the 'replace' method to an *object*, not an identifier.) David -- David A. Black dblack@wobblini.net