. Matz mentioned procs and blocks and then I began to ask myself, why does Ruby need both? First there are
with blocks that I don't think crop up with procs or lambda. But my biggest concern is that having both just makes the language more complicated than it needs to be.
In particular, is there anything I can do with a block that I can't do with a proc or a lambda? If functions are first class objects, then I should be able to pass a proc or lambda
along with it's closure to another function, and execute it in that function. Then there would be no need for a special "yield" operator. It's true that the block syntax allows for some syntax-sugar like:
get '/foo' do
...
end
but the contents of the 'do' could just as well be treated as a lambda, with it's own scope and closure etc. Just give it a default name in get(), like 'the_proc' or whatever and invoke it like any other function if it's not nil.
Am I the only one who's asked this question?