zorael / kameloso

IRC bot with Twitch support
Boost Software License 1.0
8 stars 3 forks source link

Plugin registration via module constructors #145

Closed zorael closed 1 year ago

zorael commented 1 year ago

So far we've been keeping a big list of module string names, which we then resolve to actual module symbols during compilation and introspect for IRCPlugin subclasses to instantiate. This had the drawback that you had to go modify the file (plugins/package.d) whenever you add or remove a plugin.

With this new approach each plugin module simply has to mix in a ModuleRegistration template, and module constructors are used during runtime to register that module for plugin instantiation. The introspection to find the IRCPlugin subclass is naturally still done during compilation, at point of mixin.

Some steps were necessary and new modules created to take to avoid cyclic dependencies. Lastly, this project no longer builds with 2.084 compilers, and the new lowest supported is 2.085.