Why can’t I use `suspend fun foo(): T` instead of ...
# javascript
m
Why can’t I use
suspend fun foo(): T
instead of
fun foo(): Promise<T>
in an
external interface
?
j
Because they don't work the same way. Suspend functions receive a continuation and return synchronously when suspended. A promise is an encapsulation of running work like a Future.
t
Why can’t I use
You can 🙂
Compiler plugin can do this as I understand
But I see problem in such “magic” - ordinal classes can implement external interfaces.
m
@jw thanks, that explains what I see. I was surprised that my suspend funs were returning Promises :)
1