logoalt Hacker News

IsTomtoday at 11:48 AM1 replyview on HN

I'd rather compare CPS to goto than regular imperative computation.


Replies

cryptonectortoday at 3:26 PM

The continuations in CPS are closures. Goto basically isn't. GCC's computed goto is, but generally when people say 'goto' they mean the traditional C goto, which involves no closures. The goto analogy is not great for this reason.

A better analogy is that continuations are reified function call return addresses, since return addresses come with a frame pointer (explicit or implicit), and therefore are closure-like.