-
-
Notifications
You must be signed in to change notification settings - Fork 694
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
Nested Scopes #513
Comments
The approach I settled on is:
where |
the most difficult part here is to avoid mixing scope instance id and scope qualifier: The DSL allow you to define a scope with a qualifier. A scope instance id is created/given at runtime. |
this will be redesign as "Scope Links", to let you establish links between your scope instances. |
What's the status of this "Scope Links" stuff? Anywhere i could read the docs or at least the implementation code/related PR and the architecture design for this feature? |
any news? |
Says complete in 2.1 but still not working. You can do
Works but not ideal |
Is your feature request related to a problem? Please describe.
Currently, with Koin 2.0 it's possible to declare nested scopes:
With implied understanding that:
However, that's not what's happening. In Koin 2.0, the above DSL is equivalent to:
... and at runtime, the
get(NUMBER)
will throw aNoBeanDefFoundException
.Koin should do better than that.
Describe the solution you'd like
Nested scoped should be supported. For that, two things are necessary:
ScopeSet
needs to definefun scope
similar toModule
.Scope
needs to definefun createScope
similar toKoin
- for the nested scopes.Describe alternatives you've considered
An alternative to nested scopes is doing extra work (like duplicating same bindings across multiple scopes - but that will break singletons)
The text was updated successfully, but these errors were encountered: