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

[macro] disallow redefining modules #12001

Open
wants to merge 11 commits into
base: development
Choose a base branch
from

Conversation

kLabz
Copy link
Contributor

@kLabz kLabz commented Feb 11, 2025

Also note that this was allowed in Haxe 4 too.

  • Implement haxe.macro.CompilationServer.invalidateModule() to give a way to actually replace a module (that is not loaded yet)
  • Fix the stuff that makes some tests break.. 😅
  • (?) Move the hook to somewhere it belongs

@kLabz kLabz force-pushed the macro_disallow_redefine_module branch from 181828c to cf14ba3 Compare February 11, 2025 13:51
@kLabz kLabz marked this pull request as ready for review February 12, 2025 07:59
@skial skial mentioned this pull request Feb 12, 2025
1 task
@Simn
Copy link
Member

Simn commented Feb 12, 2025

This whole hook approach doesn't make sense to me. There should be exactly two cases when dealing with modules via define_module and define_type:

  1. The module already exists in the current compilation context (com.module_lut). In this case we give a redefinition error.
  2. The module doesn't exist in the current compilation context. In this case we add it and dirty any cached modules matching it. This will cause any of its dependents to pick up the new module.

What exactly isn't working with this general approach?

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