3 ms·
Indeed. For some reason, closures never tripped me up, but continuations took a while to wrap my head around. (I think because I tried to learn continuation-pas
by silentbicycle 16y ago
Indeed. For some reason, closures never tripped me up, but continuations took a while to wrap my head around. (I think because I tried to learn continuation-passing-style first. While also learning OCaml.)
Since you know C, it might help to think of continuations in terms of setjmp/longjmp, but with multiple, persistent stacks. (Same with coroutines, but coroutines and continuations have a lot of overlap.)
- jacquesm 16y ago> in terms of setjmp/longjmp, but with multiple, persistent stacks. That's exactly the thing I used to help me visualize it :) Funny you came up with the exact same model. Setjmp and longjmp are by the way probably two of the most abused calls in the C runtime package. But when you need them, you need them badly.