From: Bulat Ziganshin Date: 2003-02-27T17:52:32+09:00 Subject: Re: Return Values of [] for Array, Hash,... (ruby 1.6.8) Hello Michael, Thursday, February 27, 2003, 11:38:42 AM, you wrote: >> > def fu h, key, o >> > e = h[key] >> > e.val = f1(o) >> > e.val2 = f2(o) >> > end MB> The problem is the following (not mine): MB> If the above function (which was an example of the core problem) is MB> taken generic, if modifications are done by a proc passed as forth MB> parameter, you'll need an extra line h[key] = e at the end to make this MB> "algorithm" work for Integers too. So, as this example shows, it would MB> be useful for generic programming, when all types are handled the same MB> way. ALL TYPES ARE HANDLED SAME WAY. code above contains one assignment and two function calls, it is equal to: e = h[key] e.send("val=", f1(o)) e.send("val2=", f2(o)) -- Best regards, Bulat mailto:bulatz@integ.ru