On Wed, Jun 24, 2009 at 2:08 PM, Lex Spoon<sp...@google.com> wrote:
> Thoughts?  The main downside I know of is the one John Tamplin has
> pointed out: if there are multiple runAsync calls within a single
> class -- as sometimes happens -- then the programmer has to code up
> some new classes that will only be used for naming.  Can we live with
> that?

Would enums fix that?  It's proposal 3.14E308, or something, so maybe
it should be skipped, but it's easy to add another constant to an
existing enum and they're just as easy to document.  Maybe provide a
marker interface like SplitPointNameMarker in the GWT library and
3rd-party libraries can do this:

public enum SplitPoints implements SplitPointNameMarker {
  SplitOne, SplitTwo;
}

GWT.runAsync(SplitPoints.SplitOne, callback);
GWT.runAsync(SplitPoints.SplitTwo, callback);

To me, using MyClass.class as an identifier is a lot like using an
open-ended enum, so it would make sense to me for runAsync to have
three overloads:

runAsync(Class<?> id, AsyncCallback callback);
runAsync(Enum<? extends SplitPointNameMarker> id, AsyncCallback callback);
runAsync(AsyncCallback callback);

but I might be crazy.

Ian

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

Reply via email to