dido/arcueid — comment on commit a6b7209edf15d4d8002b17716fcd108fbb90dad7
File:  line 0
By dido:

It actually proved a lot simpler to implement call/cc than I first expected. Every function application generates a continuation (which is used by the subsequent ret instruction), and all that ccc has to do is put that current continuation onto the value stack. Then, all that was needed was to just provide a mechanism for applying a continuation with an argument, which basically meant restoring the continuation and then placing the value that was applied to it in the value register (making it look as though ccc had returned with the value applied to the continuation).

Of course, the pesky protect function (which is essentially Scheme's dynamic-wind) creates complications. Instead of just applying the continuation as before, I now have to go up the continuation list and execute all the registered protect functions until I get to the continuation I'm supposed to apply. I've heard of the Hanson-Lamping algorithm for implementing dynamic-wind which is supposed to be more efficient but I've so far only seen vague references to an unpublished manuscript. *shrugs*