-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document multi-shot generators #80
Comments
Supporting all of the generator API is a large project, so maybe just implement the very basics, showing how it could be done. With the new So, let's include such a short demo in 0.15.2. |
See #80. This still needs to be moved into its own module.
Example moved into |
Now we just need to update the documentation, particularly the section on continuations in
|
Now the demo includes also a |
As of v0.15.0, there is a toy implementation of multi-shot generators (i.e. re-resumable generators) buried within the automated tests, see unpythonic.syntax.tests.test_conts_gen.
Playing around with the idea, multi-shot generators seem a much nicer API to use continuations with than the low-level
call_cc[]
.Thus, we could extract it into a proper
mcpyrate
macro, and add it to the public macro API.We should caution in the docs that it'll only work inside a
with continuations
block, since doing things like this in Python requires a CPS conversion. Or maybe make this another, alternative multi-shot-continuations API, and internally compile into awith continuations
.This requires first fleshing out some details. Ideally, a multi-shot generator should look similar to a classical Python generator, with only the difference that a multi-shot generator can resume again from an earlier
yield
(arbitrarily many times).The text was updated successfully, but these errors were encountered: