I find that there are two sources of a lot of boilerplate code for the  
async stuff I work on:

   1. State machines
   2. Coordinating multiple asynchronous events (ie: timers, multiple  
inflight requests and user events)

For #1, the code usually ends up as a set of enums for simple states  
or a set of polymorphic classes for more complicated cases.  For #2,  
we've got some simple classes that allow you to run actions based on  
certain trigger conditions.  Both of these patterns show up a lot in  
our code and while we've done a bit to try and reduce the impact of  
these cases, we're still paying a lot of boilerplate lines of "async  
tax" per screen.

There might be a way to approach this like Oni does 
(http://www.croczilla.com/oni 
): provide a set of asynchronous building blocks that you can use to  
coordinate asynchronous events. You end up building an asynchronous  
lambda function that can be applied as needed. No compiler magic  
needed: the async callbacks throughout the API provide the equivalent  
of continuations. I roughed out a GWT API for this some time ago and  
it seemed like it would be reasonably easy to do as a third-party  
library.

Matt.

On 1-Nov-09, at 9:31 AM, Bart Guijt wrote:

> On 1 nov 2009, at 1 nov, 17:24, John Tamplin wrote:
>
>> On Sun, Nov 1, 2009 at 10:38 AM, Bart Guijt <bgu...@gmail.com> wrote:
>> Although I concur with Bob Vawter's comment, I still think there's a
>> place for a compiler transformation like this. The proposal is not to
>> meet incompetence levels of Java programmers, it is to enable  
>> existing
>> Java libraries in GWT client code (AFAIC).
>>
>> I think that is precisely the reason you don't want to allow it --
>> existing libraries are written with the implicit assumption that
>> such calls are synchronous.  The whole idea behind runAsync is that
>> by explicitly specifying where the split point happens, the
>> programmer can structure the code better to handle the load there,
>> the associated delay, and possible failures.
>>
>> You can see the problems MS has had trying to transparently turn
>> synchronous calls into asynchronous ones first with Volta and then
>> another attempt I can't find the name of quickly.
>>
>> Also, it isn't just this method that would have to be written to
>> pass a continuation but everything on the callstack, and if just one
>> such method were possibly called basically the entire program would
>> have to get transformed.
>
> Well, you got a point :-) Didn't know Microsoft attempted the same
> thing.
>
> Thanks for your reply!
>
> Bart Guijt
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to