Hunter
09/19/2025, 5:14 PMKFunctions in places where lambdas with context are expected. For example
class Server
data class Foo(val action: context(Server) (Int) -> Unit)
context(_: Server)
fun doSomething(int: Int) { ... }
// val foo = Foo(::doSomething) This currently doesn't work
val foo = Foo { doSomething(it) }
I would really like to be able to pass ::doSomething into Foo, but it doesn't work currently.
I know context parameters are experimental, is this something expected to be fixed/added in the future? There's a YouTrack issue for this, but I don't see any timeline for it or if it's even expected to change.Youssef Shoaib [MOD]
09/19/2025, 6:23 PM::doSomething eagerly grabs the available contexts (this behaviour is shared with Scala I believe). Maybe that'll change though, so that it grabs as many contexts as it can, but leaves the rest intactPavel Kunyavskiy [JB]
09/29/2025, 8:42 AM