So far I have: ```inline fun <reified T: Any&gt...
# kodein
d
So far I have:
Copy code
inline fun <reified T: Any> Kodein.Builder.singleton(noinline creator: suspend NoArgBindingKodein.() -> T) = SingletonCoroutineBinding(generic(), creator)

class SingletonCoroutineBinding<T : Any>(override val createdType: TypeToken<T>, creator: suspend NoArgBindingKodein.() -> T) : ASingleton<T>(creator) {
	override fun factoryName() = "singleton"
}
But I'm getting that
init
is internal in
ASingleton
...?
No go with this:
Copy code
abstract class ACoroutineSingleton<T : Any> internal constructor(val creator: suspend NoArgBindingKodein.() -> T) : NoArgBinding<T> {
	private @Volatile var _instance: T? = null
	private val _lock = Any()

	override suspend fun getInstance(kodein: NoArgBindingKodein, key: Kodein.Key<Unit, T>): T {
		synchronizedIfNull(_lock, this::_instance, { return it }) {
			_instance = kodein.creator()
		}
		return _instance!!
	}
}
Since getInstance() is not suspend in the interface... Any other way?
It looks like it's a no go with the current code base... ­čśó