Skip to content
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

Defer coroization #17

Merged
merged 4 commits into from
Sep 16, 2024
Merged

Defer coroization #17

merged 4 commits into from
Sep 16, 2024

Conversation

jcheng5
Copy link
Collaborator

@jcheng5 jcheng5 commented Sep 12, 2024

Don't perform coro::generator/coro::async_generator transformation at package build time; if we do so, we're basically hardcoding the coro transformation into that built package, which might be a problem if coro is then upgraded.

We take two approaches to this:

  1. Simple functions use rlang::on_load to defer their definition until package .onLoad.
  2. For R6 methods we take the complicated generator_method/async_generator_method decorators and make them even more complicated, by having them defer the coro transformation until the first time they are invoked.

Prevents accidentally statically importing code from coro,
which could cause problems if coro is then upgraded to a
newer version than elmer was built with
@jcheng5 jcheng5 requested a review from hadley September 12, 2024 20:27
Copy link
Member

@hadley hadley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was looking a bit to see if there was an obvious way to take the same approach for the methods (and hence eliminate @include), but I haven't found it yet.

@jcheng5 jcheng5 merged commit 326c641 into main Sep 16, 2024
10 checks passed
@jcheng5 jcheng5 deleted the defer-coroization branch September 17, 2024 00:03
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