Hello, > IIRC, the stack copying in Guile's continuation implementation is > inevitable. Though it's inefficient, the consideration is to cooperate with > other languages such as C.
It's inevitable in the general case, where the continuation might return multiple times. However, in this situation, he knows the continuation will only ever return once, so it is not necessary to copy the stack. This control structure will be the equivalent of setjmp and longjmp in C. Prompts have an optimization where they don't actually copy the stack if it is clear that they can only return once. That is why catch and throw are implemented that way. Noah