Thursday, June 5, 2008

GWT Exporter:The Next Generation

Now that GWT 1.5 is out, it's time to look at revising my GWT Exporter library to take advantage of new features, as well as improve it speed/performance. Here are some of the features I'm looking at including in GWT Exporter 2.0

1) Support for 1.5 annotations (place @Export in front of a method to export it)
2) Export as Deferred Binding controlled by property (e.g. add ?export to URL or use <set-property) to avoid the overhead when you don't need it. For example, today Chronoscope always exports methods, even if you are including it inside of 100% GWT app. There should be zero overhead/cost when not being used.
3) Eliminate wrapper classes and bridge methods. Today, GWT Exporter generates Javascript classes which wrap GWT classes and expose methods. In 2.0, it should achieve exporting by adding non-obfuscated method aliases to GWT objects themselves.
4) Export as pure-JS libraries (no bootstrap script) with JSDoc annotations. Ideally, I copy could Javadoc from Java to JSDoc, but it's problematic since Generators don't get comments exposed to them (except for metadata)

If you have any feature suggestions for the Exporter, leave them here in the comments.

-Ray

4 comments:

stuckagain said...

What about putting this in the incubator so that one day it will be part of GWT ? This is very usefull stuff for a lot of real life GWT applications.

ahhughes said...

Hi Ray, I was wondering if this was part of the 1.5 core... obviously not. See http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/300b49a9e65a52cd/34582727f8a6e0d5?lnk=gst&q=introspection#34582727f8a6e0d5 never the less, I'm certainly interested. It's also seems that theres at A LOT more to come from annotating GWT.

Ray Cromwell said...

@stuckagain,
I could submit it to the incubator, but I doubt it would make it into GWT. The optimal and proper way to do exports would use the compiler to do it, rather than a separate generator. I think exporting will make it into a future GWT compiler. In the meantime, the GWT exporter library will be there to cover the gap.

@ahhughes,
Yes, it's not part of core, just like JSIO (the reverse of GWT Exporter). I think you're going to see the bridge to Javascript get more and more painless with future GWT releases. The 1.5 overlay type system being a great example.

Knurd said...

Personally I cannot see myself using GWT in any other way. I don't like having so little control over JavaScript components. Exposing an API through JavaScript decouples the application from the component so that I can reuse my GWT components any way I want to.