Sorry, just realized I left out the example I meant to give. I'll insert it below: On Saturday, June 28, 2014 2:37 PM, Andrew Barnert <abarnert@yahoo.com.dmarc.invalid> wrote: [snip]
And if you want to write a function that takes two functions, with an optional keyword argument after them, it can still take them both inline, quite readable. Ruby users claim they don't miss this ability, but anyone who uses promises in JS (or anything at all in Haskell) can think of dozens of times they passed non-final function arguments today, and wouldn't be happy with an API that made that impossible.
Here's some slightly simplified real-life JS code using Promises: db.select_one(sql, thingid) .then(function(rowset) { return rowset[0]['foo']; }, log_error); Here's what the same code looks like with a Ruby port of Promises: db.select_one(sql, thingid) .then {|rowset| rowset[0]['foo'} .then(nil, proc {|err| log_error(err)}) I think this shows why blocks are a second-rate substitute for first-class, closure-capturing, inline-definable functions (which Ruby and ObjC don't have, but JS and Swift do). The only reason anyone should want blocks in Python is if they're convinced that it's impossible to come up with a clean syntax for multiline lambdas, but it's easy to come up with one for multiline blocks.