On Tue, Apr 21, 2015 at 5:40 PM, Jens <[email protected]> wrote:
> Damn it, Safari crashed. So now a shorter version of my answer: > > First I agree that the current design has become quite confusing. > Personally I really dislike the single @Js annotation approach because: > - can be applied everywhere so you throw away some compile time checks > provided by Java's @Target annotation > Agreed. - exports vs. export is a bit misleading. One must be used with > interfaces/classes the other with methods. That issue only exists because > @Js alone has no real meaning. > Mostly agreed though @Js alone has meaning. As there are no exports, the methods can be pruned. This difference will be more significant when we change the output style to be more idiomatic javascript and have a closer integration with Closure compiler in the future. > - You have to type more because it is always annotation name + property + > value if you can't stick with the default "@Js". > I'm assuming you are comparing Option 1 and Option 2 (see my recent email). Based on that I'm not sure which part you are referring. Can you give an example? > - Can't see a good use case for splitting exports in ALL, INSTANCE_MEMBERS > and STATIC_MEMBERS. When I want to export a class I want to export its > public API. > > Yes, that was my assumption as well and that's how I started. But looking at real life code inside Google, especially in places where the code is shared by different platforms, I see people choosing to only export instance members or static members. I will need to re-evaluate this after we migrate all Google code to new annotations. > > Personally what describes JsInterop best is the alternative using the > import/export concepts. So I would stick with: > > Import/Export types: > > @JsImport: can only be applied on interfaces. > @JsExport: always exports all public API in a given scope (package, class, > method). So no ALL, INSTANCE_MEMBER, STATIC_MEMBER distinction. @JsIgnore > can be used to opt-out selectively. > > Configure import/export: > > @JsNamespace: import/export from/to namespace > @JsName: workaround reserved keywords > @JsProperty: mark method as JS property > @JsIgnore: opt-out of export. Might even be useful for import, e.g. do not > generate trampoline for annotated default method. > > Special constructs: > > @JsLiteral > @JsFunction (currently it seems not to be a real function which breaks > interop > <https://groups.google.com/d/msg/google-web-toolkit/PHtfLTSAJDM/oJjAo3qWa7sJ> > ) > > This is the one I listed as Alternative 2 in the doc (Option 3 as I re-listed in the recent email). It doesn't hold water well; works well for simple but gets confusing quickly as there are many gotchas. > > I guess that is the cleanest you can get. Not sure what @JsOpaque is good > for?! > > It is not committed: https://gwt-review.googlesource.com/#/c/12210/ The description in the patch needs an update but in most simple terms, it is used to mark parameters that are only intended to be used as opaque object in javascript side. This will prevent accidental passing of types that are not usable in javascript while it will give us more room in changing the behavior for non-jstype parameters in the future. > -- J. > > -- > 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/778b8f0b-8cc1-4a90-84d5-39c1b9c02afb%40googlegroups.com > <https://groups.google.com/d/msgid/google-web-toolkit-contributors/778b8f0b-8cc1-4a90-84d5-39c1b9c02afb%40googlegroups.com?utm_medium=email&utm_source=footer> > . > 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/CAN%3DyUA3tJODfbstJC%3DnUxd0-q_t%3DS0SuK4V%3DYgn-yRKdAH9T4w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
