Youssef Shoaib [MOD]
08/30/2025, 10:27 AM@Bridged
KSP plugin yet that generates contextual bridge functions?Javier
08/30/2025, 11:56 AMefemoney
08/30/2025, 1:20 PMYoussef Shoaib [MOD]
08/30/2025, 1:22 PMinterface Logger {
fun log(msg: String)
}
To make this available contextually, I have to write a function:
context(l: Logger)
fun log(msg: String) = l.msg()
But I'd like this to just get generated through an annotation insteadefemoney
08/30/2025, 1:24 PMYoussef Shoaib [MOD]
08/30/2025, 1:26 PMinterface Logger {
@Bridged
fun log(msg: String)
}
which generates the context function as above
Or even:
@Bridged
interface Logger {
fun log(msg: String)
fun logd(msg: String)
...
}
to have it done to multiple methodsefemoney
08/30/2025, 1:31 PMfun myLogic(logger: Logger) {
logger.log(...)
}
// OR with context parameters
context(logger: logger)
fun myLogic() {
logger.log(...)
}
to
fun myLogic(logger: Logger) {
logger.run {
log(...)
}
}
Pardon the questions but I am genuinely struggling to see the usefulness 🤔Youssef Shoaib [MOD]
08/30/2025, 1:32 PMcontext(_: logger)
fun myLogic() {
log(...)
}
Maybe Logger
isn't the best example. Think async
for instance.Javier
08/30/2025, 1:33 PMlogger.log(“…”)
You can just
log(“…”)
efemoney
08/30/2025, 1:35 PMCLOVIS
09/01/2025, 8:07 AM