24 Oct
2012
24 Oct
'12
5:06 a.m.
Sam Rushing wrote:
1) in the phrase 'continuation-passing style', it means a 'callback' of sorts. 2) as a separate term, it means an object that represents the future of a computation.
They're not really different things. When you call a continuation function in a continuation-passing style program, you're effectively invoking *all* of the rest of the computation, not just the part represented by that function. This becomes particularly clear if you're able to make the continuation calls using tail calls. Then it's not so much a "callback" as a "callforward". Nothing ever returns, so forward is the only way to go! -- Greg