https://kotlinlang.org logo
#kodein
Title
s

salomonbrys

09/07/2016, 10:59 AM
@apatrida: At the moment, after a
ConfigurableKodein
has been declared mutable and "constructed" (e.g. accessed for the first time), you can add modules to it only by using
mutateAddModule
.
addModule
will still throw an exception. That's the current state. I'm worried that this is not very portable: a function that takes a
ConfigurableKodein
as argument and adds modules to it does not necessarily have to know if the kodein object is being constructed or mutated. So I'm thinking to remove this restriction and allow to add modules to a mutable
ConfigurableKodein
directly with
addModule
(and thus deprecate
mutateAddModule
). On the other hand, I do not want to encourage mutability as it should only be used in very specific cases (like unit testing) and I worry that deprecating
mutateAddModule
would encourage bad practices (and horribly hard to debug weird bugs). So here's the dilemma: protability or good practices ???