> In general these kind of scenarios would be a good fit for 
> Futures/Promises especially if you depend on multiple asynchronous calls. 
> https://code.google.com/p/gwt-async-future/


IMHO Futures don't buy you anything in GWT. In Java Future.get() blocks 
until the result is available, in GWT you just can't do that. Thus you 
still need a callback so that you know when the Future has its result 
filled. Otherwise you would need a Timer and periodically check if the 
Future is ready to read. At the end you probably write more code than you 
should (in addition to the code you have introduced through the library 
itself).

 

> https://code.google.com/p/gwtquery/wiki/Promises


Looks a lot better but at the end its just a more declarative way of 
working with callbacks. I am not sure if this helps here. 
But because of the use of the Function interface it will probably read 
really well in IntelliJ and later helps a lot once GWT supports Java8 
lambdas. I do something similar, see 
https://groups.google.com/d/msg/google-web-toolkit-contributors/UzESJTd_JxU/p9UbnWxlWQQJ



The key point is that Magnus wants to encapsulate asynchronous behavior but 
from the outside calls a synchronous method that depends on this 
encapsulated asynchronous behavior. IMHO the best way to solve this is to 
not be in that situation :-)

-- J.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to