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

Automatic initialization #31

Open
0x0f0f0f opened this issue Mar 25, 2021 · 2 comments
Open

Automatic initialization #31

0x0f0f0f opened this issue Mar 25, 2021 · 2 comments

Comments

@0x0f0f0f
Copy link

Is it technically possible?

!isdefined(mod, RGF._tagname) && RGF.init(mod)

If I do this right before generating a function I get a world age error.

@c42f
Copy link
Contributor

c42f commented Mar 26, 2021

Unfortunately I don't know how to do this in full generality, otherwise I'd already have done it. It's semi-possible to do as a side-effect at macro expansion time if people only use the single-argument @RuntimeGeneratedFunction constructor. These kind of side-effectful macros are somewhat evil, however ;-) Furthermore, this wouldn't work for the other constructor forms.

The ability of RGFs to avoid world age errors is entirely tied to running the init code early - the init code defines a generated function with an early world age which all dynamically generated RGFs will inherit.

@c42f
Copy link
Contributor

c42f commented Mar 26, 2021

So yeah, to be more blunt - I don't think this is possible :-)

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

No branches or pull requests

2 participants