Created
July 12, 2020 14:24
-
-
Save rygelouv/14e9559967a5514829079a4057a1a9bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Module { | |
val declarationRegistry: MutableMap<KClass<*>, Declaration<Any>> = ConcurrentHashMap() | |
inline fun <reified T: Any> factory(noinline declaration: Declaration<T>) { | |
declarationRegistry[T::class] = declaration | |
} | |
operator fun plus(module: Module) = listOf(module, this) | |
} | |
operator fun List<Module>.plus(module: Module) = this + listOf(module) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment