janvladimirmostert
10/09/2022, 4:51 PMobject A {
fun Server.wire() { TODO() }
}
object B {
fun Server.wire() { TODO() }
}
how do I call wire from both object A and B considering they're both extension functions?
Server().apply {
wire() // wire A
wire() // wire B
}
is it possible to do something like A::wire()
and B::wire()
?ephemient
10/09/2022, 5:24 PMwith(A) { wire() }
with(B) { wire() }
janvladimirmostert
10/09/2022, 5:29 PMjanvladimirmostert
10/09/2022, 9:57 PMobject A {
context(Server)
fun wire() { TODO() }
}
object B {
context(Server)
fun wire() { TODO() }
}
now I can just do
with (Server())) {
A.wire()
B.wire()
}
Johann Pardanaud
10/10/2022, 8:47 AMimport some.package.A.wire as wireA
import some.package.B.wire as wireB
Server().apply {
wireA()
wireB()
}
janvladimirmostert
10/10/2022, 9:32 AMephemient
10/10/2022, 1:00 PMobject
, yes that works. need to use the other methods for context if they're not, though