Hello Asynchronous World

70 views
Skip to first unread message

Aaron Novstrup

unread,
Jun 2, 2011, 12:16:19 PM6/2/11
to scal...@googlegroups.com
I was able to get this code running in the Hello World sample.  For now, the RPC is faked with a Timer that executes continuations off a queue every 3 seconds, but this is definite progress.  The state of the label goes from "Loading..." to "Hello ... World!" to (after about 3 seconds), "Hello Asynchronous World!".

val f = new Label("Loading...")
RootPanel.get().add(b);
RootPanel.get().add(f);

import Async._
val service = new SomeService
asynchronously {
   val response = service.callAsyncMethod
   f.setText("Hello " + response + " World!");
}
f.setText("Hello ... World!")

Rob Heittman

unread,
Jun 2, 2011, 12:22:43 PM6/2/11
to scal...@googlegroups.com
:: applause ::

I have been too buried with work to weigh in, but I do just want to say that I really like this approach! I agree with your general observation that it's not really about creating a synchronous RPC system, but rather about providing a choice for more straightforward code and better readability in certain (very common) cases. I bet many developers will find this style very easy to read and reason about. I certainly do.
Reply all
Reply to author
Forward
0 new messages