On Wed, Jun 24, 2009 at 9:32 AM, Lex Spoon<sp...@google.com> wrote:
> It's the *call* of runAsync that the compiler pays direct attention
> to, not its argument.  That's why I am pushing back against approaches
> that annotate some aspect of the argument.

I think the push-back is a really good idea.  It seems like this is a
tricky thing to get right and it would be a royal pain to redo it.

My personal favourite is option 6, with some caveats.  I think, to
make option 6 work, you need the compiler to be able to prove that a
given argument to runAsync is assigned exactly once before passing it
to runAsync, and that it's not reused.  I think you can satisfy the
first requirement by requiring that the local is declared final.  I
don't know if it's possible to make sure it's not passed to two
different runAsyncs.

So, what I'm saying is this:

// final is required to make sure callback is assigned only once
@SplitPointName("foo")
final AsyncCallback callback = chooseACallback();
GWT.runAsync(callback);

// this should be a compiler error because it's a second split point
with the same callback instance
GWT.runAsync(callback);

The following should be allowed:

@SplitPointName("foo")
final AsyncCallback callback = chooseACallback();

if (flipACoin())
  GWT.runAsync(callback);
else
  GWT.runAsync(callback);

If it's not possible (or not feasible) to make it a compiler error to
reuse a callback, then I prefer option 4 over option 1, but either
would be fine.

Ian

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

Reply via email to