News for hackers. Stuff that matters.
Re:Why blocks make Ruby methods slower by barrkel on Friday February 27, 2015 @02:39PM (#9120834)
Downward funargs are cheap. First class functions are more expensive. Naming a value permits first-class operations; unnamed values are somewhat harder to manipulate.

But in this specific case, the code could go through data flow analysis and the value passed to block determined never to escape the function, so that callers could save creating a proc. But late-bound callers may still pass an explicit proc, so the body of the function would need to work with both forms. It's not a trivial optimization.

There are no comments on this comment yet.