I’ve recently come across the &method(:method_name) syntax. (This uses the Object#method method – RDoc link) For example,
[5, 7, 8, 1].each(&method(:puts))
is the equivalent of
[5, 7, 8, 1].each{|number| puts number}
Are there performance penalties for the latter compared to the former in the various implementations of Ruby? If so, are the implementors working on improving its performance?
Yes, it appears to be bad for performance.
It looks like this is addressed in JRuby: