3 ms·
In fact, the computer science concept behind blocks, called “closures” As far as I know, the language-free concept of "block" is orthogonal to the concept of s
by djacobs 14y ago
In fact, the computer science concept behind blocks, called “closures”
As far as I know, the language-free concept of "block" is orthogonal to the concept of scope. That is, a block is not by necessity a closure.
- pat_shaughnessy 14y agoYou might be right about the general meaning of the term "block." However, in Ruby blocks happen to be implemented as closures. This was one of the main points I was trying to make... that blocks aren't as simple as they seem, at least in Ruby.
- djacobs 14y agoThat's a totally legitimate point. I'm just pointing out that the quoted bit would lead the reader to believe that a block is defined as a closure. The problem is almost everyone I talk to in the startup scene thinks that an anonymous function/block == a closure.
- chimeracoder 14y ago> The problem is almost everyone I talk to in the startup scene thinks that an anonymous function/block == a closure. This is a big pet peeve of mine - I keep seeing people use 'closure' as a synonym for 'lambda'. It's a simple error, but it bugs the hell out of me. Then again, it's a dead giveaway that the person has never programmed in a functional paradigm, which may be a good thing to know, depending on the context.