Delegation by higher-order function

Is it possible to delegate (presumably using by) a single-function interface to a higher-order function?

Is it possible to delegate individual functions to a higher-order function? e.g., either overriding another inherited implementation, or delegating each of the functions in a multi-function interface to a different higher-order function?

If not, would either of these be useful?

Are there existing RFEs?

You can do that in 1 line of conventional code:

override fun foo() = delegatToThisFunction()

I might not have understood what you are asking about.

1 Like

@fatjoe79 Thanks. Iā€™m switching from Java, so the syntax and use areas of higher-order functions in Kotlin are new to me.