I agree with you on Java idiomatic API design, but the first version won't be so specialized, we will have to hand curate overrides of the auto-generated APIs, it's not really possible to automate this.
On Wed, May 18, 2016 at 10:22 AM, Ming-Yee Iu <[email protected]> wrote: > Is it possible to get some hints about what's cooking for Elemental 2? > > Is the code generator still going to be Python or is it going to be > rewritten in Java? I found modifying the Python code generator when I wanted > to change Elemental 1 to be annoying. > > Is the output going to be a direct remapping of JS APIs to Java or are some > of the more common APIs going to be massaged to be more Java-like? With > Elemental 1, I found that the JS APIs were cumbersome to use in Java because > they were designed for use in JavaScript. A lot of type casting was > required to use the APIs, a lot of potential opportunities for compile-time > type safety were missed, lots of strings used as parameters etc. > > e.g. > CanvasRenderingContext2D ctx = > (CanvasRenderingContext2D)canvas.getContext("2d"); > > (I often forget whether it's "2d" or "2D", and that type cast is gross) > > e.g. > div.addEventListener(Events.CLICK, new EventListener() { > void handleEvent(Event evt) { > MouseEvent e = (MouseEvent)evt; > ... > } > }); > > (that would work so much better as something like > > <U extends Event> EventRemover addEventListener( EventType<U> type, > EventListener<U> listener ) > > so that it would be possible to do a > > div.addEventListener(Events.CLICK, (MouseEvent e) -> {...}); > > -- > You received this message because you are subscribed to the Google Groups > "GWT Contributors" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/google-web-toolkit-contributors/e4eeefd6-cfdf-462d-8ae7-000fa8969d07%40googlegroups.com. > > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "GWT Contributors" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAPVRV7eBh2aTjgeJZDTjDWYA9W2DSpWxAO%3DCch7ai7OqGAjTjA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
