Hacker News new | ask | show | jobs
by zorr 1263 days ago
Kotlin's features are amazing for designing DSLs but I think your code sample uses more than just the 3 points you mentioned. Specifically the `call.respondText(..)` part. I assume that in this example the second argument to the `get` function is actually a "lambda with receiver", which means that the lambda executes with another object as the receiver (and that object is bound to "this" inside the lambda block), which makes the `call` object available.
1 comments

Isn't it cool that you can't know what the code is actually by just looking at it? /s

Kotlin's scope injection is one of the most terrible "features" ever invented. It's dynamic scoping on steroids!

But dynamic scoping was long ago deemed a horrible bug and never ever made it again into any new language.