Ruby blocks, procs, and lambdas
awaxman11.github.io
awaxman11.github.io
For anyone who doesn't already know this inside and out, the tl;dr spoiler: the surprises are that procs do not even care how many arguments they are passed, and that they can return on behalf of the function in which they are executed.
Compared to lambdas, which spew runtime errors if they don't get the right number of arguments passed in, and which always return control to the line after where they were executed, regardless of whether the return keyword is used.
I'm reminded of the Dave Thomas pipelines using fibers series of articles. I'll just leave this here:
http://pragdave.blogs.pragprog.com/pragdave/2007/12/pipeline... http://pragdave.blogs.pragprog.com/pragdave/2008/01/pipeline...