On 26.03.2018 08:34, David Dawson wrote:
Hi,
I do a load of async programming, in the JVM world, mostly using RxJava
and CompleteableFuture). Not so much GPars or Reactor these days, but
the principles are fairly portable.
I've noticed that since I started using typescript on the front end,
getting access to await/ async there has been really nice for cleaning
up async code (also, some .NET langs have similar systems). Of course,
async is required in that environment, but having it able to be read in
a similar way to synchronous code is very useful, removing the nesting.
I was wondering if anyone had though about syntax support for await/
async use cases?
I did, almost 3 years ago already... then time constraints forced me to
do other things. My idea back then was to base this on gpars though. And
I was about to investigate what of the concurrency patterns can be
transformed to async/await in a reasonable manner, how that would look
like and to what extend that could be used as a general way.
CompletableFuture was not really an option back then, because of it
requiring Java 8 and the Future class... well...let´s forget about that
one. Another thing that keeps me from CompletableFuture is that it
internally already spawns threads, even if you do not use it. So I had a
lot open on the semantics side of this.
But syntax wise....
[...]
String async myAsyncMethod() {
[...]
}
[...]
def async otherAsyncMethod() {
String myString = await myAsyncMethod()
printn "My String is $myString"
}
syntax wise I think I had this (or with async annotation) on both
bye Jochen