kosi-libs / Kodein

Painless Kotlin Dependency Injection
https://kosi-libs.org/kodein
MIT License
3.21k stars 174 forks source link

ConfigurableDI.addExtend should take a copy parameter #395

Closed dalewking closed 2 years ago

dalewking commented 2 years ago

The function:

    public fun addExtend(di: DI, allowOverride: Boolean = false): Unit = addConfig { extend(di, allowOverride) }

is a nice shortcut, but it doesn't allow you to use if if you need to pass the copy parameter to extend.

A third parameter should be added for copy that defaults to the current behavior, i.e.

    public fun addExtend(di: DI, allowOverride: Boolean = false, copy: Copy = Copy.NonCached): Unit =
         addConfig { extend(di, allowOverride, copy) }