4 ms·
What exactly are extension expressions, do you mean extension methods? If so, Swift does support them. I actually miss interface extensions in Kotlin, but thats
by Alphasite_ 11y ago
What exactly are extension expressions, do you mean extension methods? If so, Swift does support them. I actually miss interface extensions in Kotlin, but thats a java cross compatibility issue.
- burntcookie90 11y agolook at the signature for `with` inline fun <T, R> with(receiver: T, f: T.() -> R): R it takes a lambda that is scoped to the receiver type `T`. This means the lambda runs in the scope of whatever is passed in as a receiver. with(list) { add(item) add(item) } This essentially lets you create DSLs for whatever. Another thing that's bit me in butt recently is that `Protocol`s aren't concrete types, unlike an `interface` in Java/Kotlin.