Draft: Register as / Replacing Modules from other Repositories#57
Draft: Register as / Replacing Modules from other Repositories#57
Conversation
…sion during development)
…s do not interfere
|
I like the idea, as I previously run into a few of those issues myself. This could be solved by adjusting the order of the paths, where miniflask looks for modules: If one specifies user first, and system later, miniflask will find user modules first, and then the system ones. (Very much like the PATH environment variable in Linux) What I don't like is the fact that the user has to know every other module in other repositories and take care of duplicates. What happens if the user uses his repository in another context? Will function calls like |
|
Thank you for your feedback. I'll first summarize the feature proposals that we talked about in the last weeks and then comment on the pros and cons each. Module-Name based replacement: Pros:
Cons:
Module-ID based replacement: Pros:
Cons:
Comment: To be honest, I do not see how the first method gives a more loose coupling of modules and requires less knowledge of the repository to replace modules in. In both cases the user needs to know the module to be replaced in a broad manner (like the events it defines) anyway? I think, both methods achieve more or less the same, however the second method allows multiple modules to serve as replacements for the very same module. Also, the method does not require the module to serve as a replacement to be placed in a separate repository. |
b98b08f to
260e362
Compare
dfa8411 to
ee089c8
Compare
Register as / Replacing Modules from other Repositories
This MR presents a proposal for replacing modules from other repositories.
Consider two repositories:
mainandreplace,where the repository
maincontains the module hierarchy that plays well together.This MR:
mainloads another module, i.e.testmodule. The module will always be searched inmain, same applies for any other repository.register_asto let one module take the place of any other module (also in other repositories).Previously, a module could only take the place of another module if that module has been called using
register_default_module.New
register_asbehavior (previously known asredefine_scope):register_asallows any module to be internally renamed to any other module in such a way that the original module will not be loaded anymoremainrepository