I'm trying to understand scopes in Koin 2.0.1, and...
# koin
w
I'm trying to understand scopes in Koin 2.0.1, and why they have both a name and an ID. The only purpose I can see would be two have multiple instances of a given named scope active at the same time. Which works, but then if you close any one of those scope, the others with the same name (but different ID) are no longer usable. What's the point?
Here's my test code: val aModule = module { scope(named("scopeA")) { scoped { "From Scope ${nextId++}" } } } val scope1 = koin.createScope("one" as ScopeID, named("scopeA")) val scope2 = koin.createScope("two" as ScopeID, named("scopeA")) println(scope1.get<String>()) println(scope2.get<String>()) // returns a different object than scope one scope2.close() println(scope1.get<String>()) // this now throws an exception