Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate usefulness of code generation for Kotlin coroutines #41

Closed
vietj opened this issue Oct 27, 2017 · 8 comments
Closed

Investigate usefulness of code generation for Kotlin coroutines #41

vietj opened this issue Oct 27, 2017 · 8 comments
Labels

Comments

@vietj
Copy link
Contributor

vietj commented Oct 27, 2017

for instance, now we use the await* suspending function like this

val id = awaitEvent<Long> { vertx.setTimer(1000, it) }

we could generate extensions:

suspend fun Vertx.setTimer(delay: Long): Long {
  return awaitEvent<Long> { setTimer(delay, it) }
}

that allow to directly write:

val id = vertx.setTimer(1000)
@stream-iori
Copy link

LGTM :)
by the way, the last line is

val id = Vertx.setTimer(1000)

@vietj
Copy link
Contributor Author

vietj commented Oct 27, 2017

actually no, this is Kotlin and that's an extension method that is available on vertx instances.

@stream-iori
Copy link

It's true, my fault. 😅

@CoreyKaylor
Copy link

This would be very preferential. There are many areas that callbacks in vertx api could be translated to coroutine suspension function and IMO would make it more idiomatic kotlin and simpler for those approaching vertx as well.

@feiyanke
Copy link

feiyanke commented Mar 9, 2018

It is useful if working with coroutine. Is this code generator done by vertx-codegen?

@vietj
Copy link
Contributor Author

vietj commented Mar 9, 2018

@feiyanke yes, it is currently implemented for data object and Kotlin in this project

@phiSgr
Copy link

phiSgr commented Apr 2, 2018

I have spent the long weekend to come up with this pull request #53 .
The code is quite hacky for now though. 😕

Would anyone mind reviewing before I continue?

@tsegismont
Copy link
Contributor

Closing as outdated, coroutines support has been implemented

@tsegismont tsegismont closed this as not planned Won't fix, can't repro, duplicate, stale Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

6 participants