[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] Continuations
From: |
Josh Barrett |
Subject: |
[Chicken-users] Continuations |
Date: |
Sun, 17 Jul 2016 01:26:02 +0000 |
Okay. Let's see if I've got this straight.
A continuation is a capture of your location in a program, and its pending operations to return a result. In other languages, this is often represented by the stack.
When a continuation is captured, the current state of the stack is captured and can be restored later.
The value of variables within the scope of the continuation are not captured: if variables are initialized within a lexical context, a continuation of that context is captured, the values of those variables are altered, and the continuation is restored, the variables will not reset to their original values.
In chicken, capturing a continuation is cheap, because you need only take a pointer to a set of data, and register that with the GC. In most other scheme implementations, escpecially those with a stronger focus on C interop, capturing a continuation is expensive, because you need to copy the entire program stack.
Did I get anything wrong or miss anything?
- [Chicken-users] Continuations,
Josh Barrett <=