bdawg.io
inline fun <T> T.scope(block: T.() -> Unit) { block() }
unit
scope
class MyKtorService : (Application) -> Unit { override fun invoke(app: Application) = app.unit { authentication { ... } routing { ... } } } fun main(args: Array<out String>) { embeddedServer(Netty, module = dagger.myKtorService()).start(wait = true) }
Unit
override fun invoke(app: Application) { app.run { authentication { ... } routing { ... } } }
T.scope
val list = listOf("one", "two", "three") list.scope { forEach { println("item: $it") } map(String::capitalize).forEach(::println) ... }
A modern programming language that makes developers happier.