From: Guillaume Marcais Date: 2004-05-25T19:48:17+09:00 Subject: Re: [RCR] Numeric#of Le 25 mai 04, � 05:15, Gavin Sinclair a �crit : > Here is a simple untested implementation which supports the existing as > well as the proposed behaviour. > > class Integer > def times(&block) > (0...self).map(&block) > end > end > > 5.times { puts "Hello" } # existing use of Integer#times > n = 1 > 6.times { |i| n = n * i } # existing use of Integer#times > a, b, c = 7.times { Array.new } # *new* use of Integer#times But in that case, an array is built and return even if I use times as a loop. That could be pretty bad performance wise. Unless the interpretor as a way to know that the return value is not used and does not build the array in that case. Guillaume.