Is there a way for me to make `invoke()` inlined o...
# codereview
r
Is there a way for me to make
invoke()
inlined or otherwise achieve what I’m attempting in
doWork()
?
m
Are you sure this is the correct code? Just
invoke()
without parameters would result in
fooImpl()
not
fooImpl { … }
which takes a lambda. What about this:
Copy code
interface Foo {
  //abstract stuff
}

inline operator fun Foo.invoke(block: () -> Unit) {
  //doing stuff
}
No way to override
invoke
here though and no, you cannot make
inline
functions overridable 🙂
r
Yes, sorry, mine does take a lambda. That’s a typo from moving my implementation to a most-simple-example state. I’ve been operating under the assumption that it’s impossible to achieve. Thanks for the response!