A very good write-up, Joel. I especially like that you mentioned the union types. I recently "discovered" them myself, in that I found myself wanting a FooAndBar interface and I realized that just such a union was possible without actually declaring a new interface. It seems to be a pretty low profile feature.
Thanks for sharing! On Thu, Jul 23, 2009 at 9:49 AM, Joel Webber<j...@google.com> wrote: > I'm bringing this back up again because of a recent ping to an issue-tracker > entry about "more interfaces". > I understand your pain, but these are issues with the Java language which > we've discussed at length in the past, and to my knowledge reached no > substantive conclusions other than: > - A few more interfaces in very specific places (e.g., "InsertPanel") would > be useful. > - We can't run off and create custom interfaces for the cross-product of > every characteristic interface and have every widget implement them. It > turns into a permutation explosion of interfaces. If java had some kind of > trait system or "implied interfaces" the story would be different, but alas, > we're stuck with it the way it is for the foreseeable future. > Making Widget an interface (IWidget?) sounds appealing in theory, for > reasons you describe, but there are also very good reasons for leaving it as > a concrete base class. This has come up often enough that I just created a > wiki page explaining precisely why Widget is an abstract base class as > opposed to an interface here: > http://code.google.com/p/google-web-toolkit/wiki/WhyWidgetIsAClass > On Fri, Apr 3, 2009 at 6:00 AM, Ed <post2edb...@hotmail.com> wrote: >> >> Hellu, >> >> I would like to know whtat the current status is of "incoparating more >> basis interface in GWT"? >> >> We talked about this a long time ago, but there more important issues >> then: >> >> http://groups.google.com/group/Google-Web-Toolkit-Contributors/browse_thread/thread/2aad0c3459e2c7f/cd59f6b35714ed31?lnk=gst&q=more+interfaces >> >> I still keep on bouncing my head against these kind of interface >> issues: >> Below another example, which I hope would give some more priority to >> the issue: >> >> I need a general TextWidget that "extends/implements" from Widget and >> implements HasText, HasHtml. >> >> I thought I could easily solve this with Generics... Not.. really (see >> below). >> >> I want to return a Widget as result of a method that creates a Widget >> that implements HasHtml/HasText. >> I tried something like this: >> <W extends Widget & HasText & HasHTML> CmsFormatResultText<W> create >> (String item); >> >> But calling this method isn't possible as the compiler complaints that >> Widget isn't a valid substitute. >> >> Body example: >> return new HTML("aaa"); >> Which isn't correct as the compiler also complaints about not able to >> convert HTML to W... >> >> To solve this, I think I need a basis Widget interface instead of a >> Widget class. >> >> Please some feedback/advice on this. >> >> -- Ed >> >> > > > > > --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---