iboB / iboB/dynamix

Auto-unregister globally defined features

Open
#73 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
C++
Stars
693
Forks
49
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how feature_info, global instance holders, mixin registration, and plugin unloading currently interact. Compare the proposed domain metadata and reference-counting approaches, then resolve which behavior should be supported before changing the macros. Done means globally defined features no longer leak when a plugin is unloaded, with coverage for the chosen lifecycle.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.