Skip to content

Add async_gen() (async version of gen()) - #74

Open
schloerke wants to merge 5 commits into
r-lib:mainfrom
schloerke:schloerke/pr-60-completeness
Open

schloerke wants to merge 5 commits into
r-lib:mainfrom
schloerke:schloerke/pr-60-completeness

Conversation

@schloerke

@schloerke schloerke commented Oct 21, 2026 •

Copy link
Copy Markdown

Continues r-lib/coro#60 by Joe Cheng. It is in a new PR so Joe doesn't get notifications for follow-up commits. His commit is kept as-is, with him as author, on top of current main.

async_gen() creates a one-off async generator instance, the same way gen() does for normal generators. It is handy for adapting async streams with await_each(). This PR adds tests (instance creation, await() inside, chaining streams, caller env), a NEWS bullet, and says in the expr docs that await() is allowed.

Two known differences from gen() are pinned in tests: async_gen(NULL) collects to list(NULL) because async generators yield their return value, and async_gen() with no expression errors.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants