Skip to content

Instantly share code, notes, and snippets.

@rygelouv
Created July 12, 2020 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rygelouv/14e9559967a5514829079a4057a1a9bb to your computer and use it in GitHub Desktop.
Save rygelouv/14e9559967a5514829079a4057a1a9bb to your computer and use it in GitHub Desktop.
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