From: Sean O'Halpin Date: 2006-07-01T20:53:17+09:00 Subject: Re: Symbol#to_proc is just so beautiful Hi, I don't want to rain on anyone's parade, but this technique is fairly inefficient compared to using normal blocks. Consider this: class Symbol def to_proc proc{|obj| obj.send(self) } end end class Numeric def positive? self > 0 end end def symbol_to_proc (1..1000).all? &:positive? end def use_block (1..1000).all? {|x| x.positive?} end require 'benchmark' include Benchmark n = 1000 bm(20) {|x| x.report("symbol_to_proc") { n.times { symbol_to_proc }} x.report("use_block") { n.times { use_block }} } __END__ user system total real symbol_to_proc 2.031000 0.000000 2.031000 ( 2.063000) use_block 1.219000 0.000000 1.219000 ( 1.266000) Of course, that may change if Symbol#to_proc makes it into core. Regards, Sean