Is it legit to have a dedicated interface containi...
# getting-started
e
Is it legit to have a dedicated interface containing a function with a lambda with a receiver to be implemented by third parts?
Copy code
interface Action {
//    interface DSL Builder
    operator fun<T> invoke(block: T.() -> Unit)
}
Because I cant seem to properly override in the implementation..
If I try:
Copy code
object V2 : Action {
    operator fun invoke(block: Builder.() -> Unit) {..}
    class Builder
I get on
object V2
Object 'V2' is not abstract and does not implement abstract member public abstract operator fun <T> invoke(block: T.() → Unit): Unit defined in kyge.Action
while on the function itself:
Accidental override: The following declarations have the same JVM signature (invoke(Lkotlin/jvm/functions/Function1;)V):
public abstract fun <T> invoke(block: T.() → Unit): Unit defined in kyge.actions.checkout.V2
public final operator fun invoke(block: checkout.V2.Builder.() → Unit): Unit defined in kyge.actions.checkout.V2
Ps: it isn't an extension function anymore
ah nice
thanks
one thing though, I'm trying to move the
invoke
function inside the
Action
interface, but I don't know how I can call
block
from that.. I'm thinking what the best design could be
maybe adding a
val t: T
in the interface?
I'm writing a DSL helper to generate github action yaml files. The i-th action, such as uploadArtifact, should just declare the builder Then the implemented
Action<T>
interface would initialize the yaml writing