I know it's just a preview, but this just looks ho...
# random
t
I know it's just a preview, but this just looks horribly messy and hard to understand:
🧵 1
b
I could see it being used with 3rd party classes + DI to make easy to consume internal classes. or dsls now that i think about it. class Logger(val name: String) { fun log(s: String) = println("$name: $s") } class NotificationSender { fun send(s: String) = println("sent: $s") } context(Logger, NotificationSender) fun store(s: String) { log("Stored: $s") send("Success") } @Inject data class Storer(val logger: Logger, val ns: NotificationSender) {     fun NotificationSender.log(s: String) = with(logger) { store(s) } } fun main() {     val logger = Logger("Main") val ns = NotificationSender() val storer = Storer(logger, ns) storer.log("tacos") }
t
Interesting, thanks for sharing.