Skip to content

Conversation

zachdaniel
Copy link
Contributor

While investigating the changes in this PR:
elixir-lang/elixir#14451

I encountered an error about not being able to load a module at this line, implying this is called at compile time.

@josevalim pointed out that Code.ensure_loaded!/1 will have no effect at compile time, and so this was really just relying on compile order and would be non-deterministic. Code.ensure_compiled!/1 is a superset of Code.ensure_loaded!/1 and will work at compile time to ensure the depended on module is compiled.

This would appear to solve #1351.

While investigating the changes in this PR:
elixir-lang/elixir#14451

I encountered an error about not being able to load a module at
this line, implying this is called at compile time.

@josevalim pointed out that `Code.ensure_loaded!/1` will have no effect
at compile time, and so this was really just relying on compile order
and would be non-deterministic. `Code.ensure_compiled!/1` is a superset
of `Code.ensure_loaded!/1` and will work at compile time to ensure the depended
on module is compiled.

This would appear to solve absinthe-graphql#1351.
@zachdaniel
Copy link
Contributor Author

It should be noted that this error may affect people more significantly in the next version of Elixir so we may want to get this merged sooner rather than later 😄

@benwilson512 benwilson512 merged commit e0493bc into absinthe-graphql:main Apr 30, 2025
10 checks passed
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.

3 participants