|
|
|
|
|
by drnewman
391 days ago
|
|
I agree blocks are closures. But they’re call stack aware closures. Which gives them _some_ of the power of continuations. I’m also sure you’re right that they’re not implemented using continuations. However, my understanding is that Ruby was originally conceived as a language with continuations. I’ll see if I can find a reference for that. But from what I recall reading in a blog post from someone who was at a programming language conference in 1997 when Matz introduced the language that’s how he described it. |
|
What does that even mean?
If you create a block deeply within a cascade of nested function calls, nineteen activation levels deep, and return that block out of all those nestings, is it still aware of the nineteen levels that have terminated, and to what purpose/benefit?
What example Ruby code would break without continuing access to the dynamic scope that has terminated, rather than just the lexical scope?