News for hackers. Stuff that matters.
Re:Do you know Ruby’s ‘Chainsaw’ method? by troels on Thursday October 07, 2010 @03:53AM (#1767142)
Nitpickery indeed, but that won't work as expected. `fn` can be reused within the loop, depending on the runtime, so all methods will end up calling the same `desk[fn]`.
Re:Do you know Ruby’s ‘Chainsaw’ method? by warfangle on Thursday October 07, 2010 @11:22AM (#1768133)
You're right in that it won't work as expected - unless the desk methods are static. In reality, you would probably want to call

  desk[fn].call(thisContext, arguments);
Re:Do you know Ruby’s ‘Chainsaw’ method? by sharkbrainguy on Thursday October 07, 2010 @06:59AM (#1767438)
I think you might have misread the code.

Each `fn` is bound exactly once, `forEach` is not a loop.

Re:Do you know Ruby’s ‘Chainsaw’ method? by troels on Thursday October 07, 2010 @09:17AM (#1767686)
Touché