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

Behaviour as runtime dependency #12103

Merged
merged 9 commits into from
Aug 30, 2022

Conversation

marcandre
Copy link
Contributor

@marcandre marcandre commented Aug 29, 2022

With this PR, @behaviour declarations introduce only a runtime dependency instead of a compile-time.

The checks are moved from the module compiler to the parallel checker.

This requires storing the @impl statements as well as the list of @behaviours when compiling the module, for later retrieval when doing the checks.

Remains to be done: @behaviour :"Elixir.MyModule" does not (yet) introduce a runtime dependency at all and so it is possible that further changes to MyModule will not trigger checks for modules implementing it.

Notes:

  • I isolated the behaviour code to a new Module.Behaviour module, but that's not necessary and code could easily be moved back into Module

@marcandre marcandre force-pushed the behaviour_as_runtime_dependency branch from 0040270 to c0c2d65 Compare August 29, 2022 16:58
@marcandre marcandre changed the title Behaviour as runtime dependency [wip] Behaviour as runtime dependency Aug 29, 2022
@marcandre
Copy link
Contributor Author

PR ready for review. I presume the Windows OTP-25 failure is not related

lib/elixir/lib/module.ex Outdated Show resolved Hide resolved
lib/elixir/lib/module.ex Outdated Show resolved Hide resolved
Copy link
Member

@josevalim josevalim left a comment

Choose a reason for hiding this comment

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

This is fantastic @marcandre, thank you! ❤️ I have dropped 3 comments but they are all nitpicks about renaming/moving code around. :)

@marcandre
Copy link
Contributor Author

Great, thank you 😄
I should be able to update this today or tomorrow at the latest.

@marcandre marcandre force-pushed the behaviour_as_runtime_dependency branch from c0c2d65 to 860648d Compare August 30, 2022 04:48
@marcandre marcandre force-pushed the behaviour_as_runtime_dependency branch from 860648d to 839589f Compare August 30, 2022 04:59
@marcandre
Copy link
Contributor Author

@josevalim tweaks done

@josevalim josevalim merged commit 4492326 into elixir-lang:main Aug 30, 2022
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

@marcandre marcandre deleted the behaviour_as_runtime_dependency branch August 30, 2022 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants