And my last feedback. I have an asynchronous depen...
# coroutines
d
And my last feedback. I have an asynchronous dependency injection system. Right now, I'm using an interface: interface AsyncDependency { fun initAsync(): Promise<Unit> } That is now: interface AsyncDependency { suspend fun init(): Unit } @Singleton class Missions( val project: ProjectConfig, val s3client: AmazonS3Client, val buckets: BucketsConfig, val redis: RedisClient ) : AsyncDependency { lateinit var missionsBytes: ByteArray suspend override fun init() = await(async { missionsBytes = await(readResourceAsync("Missions.json")) } } It would be awesome to be able to suspend the constructor itself somehow to avoid lateinit var + other stuff: @Singleton class Missions suspend( val project: ProjectConfig, val s3client: AmazonS3Client, val buckets: BucketsConfig, val redis: RedisClient ) { val missionsBytes = readResource("Missions.json") } But probably it is too complex, right? But that would be totally a dream. Anyway I'm so hyped right now 🙂 I can see constructors like function calls, so something like this could be implemented internally creating a suspend function, and calling it at construction. The construction would be allowed just inside suspending blocks.