Reply to Message

re: blocks/closures
I notice you essentially use the words "block" and "closure" interchangeably in your write-up about Ruby blocks and closures. You also define a closure as code that can be passed around as arguments. This is not exactly true.

While being able to pass around a function is necessary to making a closure, it is not sufficient. What you describe -- a function passed as an argument -- is a callback. A closure is essentially a callback that maintains persistent access to its original context after that context's scope has closed.

Thus, Ruby blocks are syntactic sugar for callbacks, but those callbacks are not necessarily closures.

There are those who would argue with my definition, of course. Their argument basically boils down to a statement that if something is capable of being a closure, it is a closure, but I buy that no more than I buy that someone capable of being a criminal necessarily is a criminal.

By the way, I like the enso you use for your user icon. It's a bit small to make out the characters in the middle, and my knowledge of Kanji is pretty scant (to put it kindly) anyway. What does it say in there?
Posted by apotheon
7th Jul 2011