Kt So !!top!! 〈NEWEST — 2024〉

// feature: "kt so" - a 'so' scope function for Kotlin inline fun <T, R> T.so(block: T.() -> R): R { println("[SO] executing on $this") return block() } // Usage data class Person(val name: String)

Output:

[SO] executing on Person(name=Alice) Inside so block: Alice Length: 5 If that's not what you had in mind, please provide a short example of the expected input and output — then I'll deliver a complete, production-ready feature. // feature: "kt so" - a 'so' scope

For now, here's a — if you meant a custom Kotlin scope function so that logs before executing a block: T.so(block: T.() -&gt

fun main() { val person = Person("Alice") val result = person.so { println("Inside so block: $name") "Length: ${name.length}" } println(result) } production-ready feature. For now