3 ms·
> Understand continuations - Continuations are a low-level control flow mechanism. Excellent advice right there! > Scheme is the only language to implement th
by cryptonector 7y ago
> Understand continuations - Continuations are a low-level control flow mechanism.
Excellent advice right there!
> Scheme is the only language to implement them, and while you will never use them in production, they will change how you think about control flow. I wrote a blog post trying to explain them.
Hmm, well, many languages compile to a continuation passing style (CPS) intermediate. And in many languages it is important to understand continuations to understand how they work. For example, laziness in Haskell is essentially all about continuations and continuation passing style.
What is CPS? Anyone who has been in callback hell knows. In CPS a continuation is just the closure you pass to some function that it will call when it's done. In fact, even in C, the act of returning from a function is very much like the act of calling a continuation, except that by unwinding the stack, the magic of Scheme continuations is lost.
- PaulAJ 7y ago"... you will never use them in production ..." I'm a Haskell programmer. Continuations are part of my everyday toolbox.