Open sidux opened 12 months ago
Sounds like a great idea, any chance you have a rough idea how to implement this?
Whilst this is potentially a nice feature I'm hesitant on two fronts:
It's less explicit. There's now an implicit behaviour about what gets loaded. Currently in lagom all the loading is done explicitly so this is a fairly big change.
This may actually be surprisingly hard to implement in a thorough way. Python classes have a __subclasses__
property which would contain the "one implementation". However __subclasses__
only contains classes that have been loaded. So it's possible that a second subclass exists but it's not yet been loaded. This means that lagom would likely need to implement some directory scanning to find all possible classes.
One feature that can reduce some boilerplate, is that we create automatically a service for each interface and point to the implementation automatically when there is only one.
For example :
Don't have to write
container[UserProvider] = DatabaseUserProvider
What do you think ?