<@U0926QHA6>: Good point. Here's what I propose: `...
# kodein
s
@apatrida: Good point. Here's what I propose:
Copy code
// These two lines will be added either to the next release, whether it's beta6 or stable 3.0.0.
val KodeinAwareBase.lazy: LazyKodein get() = LazyKodein(lazy { kodein })
val <A> CurriedKodeinFactory<A>.lazy: CurriedLazyKodeinFactory<*> get() = CurriedLazyKodeinFactory({ kodein }, arg, argType)

class TestLazyRetrieval: KodeinAware {
    override val kodein by lazy { Kodein {  } }

    val a: String by lazy { instance<String>() } // Here you must add the generic type, so that's not great.
    val b: String by lazy.instance() // That's better :)
    val c: String by kodein.lazy.instance() // Also works with the Kodein object ;)
}

class TestLazyWithClass: KodeinAware {
    override val kodein by lazy { Kodein {  } }

    val a: String by lazy { withClass().instance<String>() } // Here you must add the generic type, so that's not great.
    val b: String by withClass().lazy.instance() // That's better :)
    val c: String by kodein.withClassOf(this).lazy.instance() // Also works with the Kodein object ;)
}