-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Actually, the
async gen
troubles aren't anything beyond the `self-r…
…eferential` `gen` block issues
- Loading branch information
Showing
1 changed file
with
9 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I feel like this section could benefit from explaining the composition rules of the "async" and "gen" effects. Right now it mostly just focuses on the self-references. Can I suggest an alternate wording here?
async
interactionsGiven this RFC proposes adding a
gen
keyword to both blocks and functions, users might reasonably expect to be able to combine them with other effect keywords such asasync
. This would result in the existence ofasync gen fn
functions andasync gen {}
blocks. The way we expect these effects to compose would be to return an "iterator which yields futures", and not "a future which returns an iterator". This RFC treats control-flow modifier keywords as sets, meaning they should only ever compose in a single way. If a user desires to express alternate formulations for effect composition such as "a future which returns an iterator", it should be possible to manually author those via RPIT.Note also that under these rules this RFC does not pose the restriction that "async iterators" need to be self-referential (
async fn next
supporting self-references). self-references are not required to provide async iterator functionality, just like they're not required for non-async iterators. For that reason this RFC considers support for self-references in iterators to be an orthogonal feature. See the section on "self-referentialgen
blocks" for further discussion on self-referential iterators.