Marc Knaup
03/13/2020, 7:41 AMoverrides = null
and overrides = false
are not documented.
From testing, it looks like that
• true
requires an override
• false
disallows an override
• null
disallows an override
So this doesn’t seem correct:
@param overrides Whether this bind **must**, **may** or **must not** override an existing binding.
I suggest using an enum here for clarity 🙂romainbsl
03/13/2020, 8:35 AMromainbsl
03/13/2020, 8:36 AMMarc Knaup
03/13/2020, 8:36 AMtrue
case.romainbsl
03/13/2020, 8:39 AMnull
or false
behave the same, I should look into it to see there is some good reason for the double possible values. Meanwhile true
will provide overriding of existing bindings. Its mostly useful when you are using modules or even mocking your dependencies for unit testingMarc Knaup
03/13/2020, 8:43 AMsilentOverrides
?
I have a case where a Kodein instance can either be created in a “parent scope” or without one. In that case I may or may not need to override something in the parent scope’s Kodein instance that I extend.
I can’t know at this point if I will override something, so true
will fail if I don’t.
Or well I could know if I explicitly request an optional instance from the Kodein instance that I extend, but that has side-effects.
Right now eventual overrides are only possible by allowing silent overrides for all bindings.romainbsl
03/13/2020, 9:09 AM