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

Auto-unregister globally defined features #73

Open
iboB opened this issue Apr 4, 2023 · 0 comments
Open

Auto-unregister globally defined features #73

iboB opened this issue Apr 4, 2023 · 0 comments
Labels

Comments

@iboB
Copy link
Owner

iboB commented Apr 4, 2023

Currently globally defined features like messages (and in the near future facts) are never unregistered.

This is because of the assumption that they will not come from plugins. A plugin can define mixins, but it should not define new messages. There seems to be no use case for this. If a use case is identified, we should take some precautions to unregister these features, otherwise they will leak when the plugin is unloaded.

Possible ways how this can be done:

  • Add a domain to feature_info (like there is one in the mixin info) and unregister with a global instance holder, like the one for mixins and type classes. Feature info will become "fatter"
  • Add a global instance holder, but use the domain tag instead of a domain member in the info. This means that macros which define features will also have to have the domain tag as an argument which will make them more unpleasant (as if they aren't enough unpleasant already)
  • Add ref count to features in domain which is increased when a mixin is registered and decreased when it is unregistered. If it reaches zero, the feature is unregistered as well

Option 2 seems the worst to me, but I can't decide between 1 and 3.

@iboB iboB added the question label Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant