Skip to content

Document multi-shot generators #80

@Technologicat

Description

@Technologicat

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 a with 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).

Metadata

Metadata

Assignees

Labels

documentationNon-executable English, for humansenhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions