--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
---
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 google-web-toolkit-co...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Actually, replace-with is only a shorthand for a generator returning a constant value (of a class that already exists).
I think in the long-run we should separate the two concepts that is being tackled by GWT.create today.First purpose is the class replacement, especially used by permutations. I think this one should not have anything to do with GWT.create. We can do any class replacement in compiler without requiring a call to GWT.create. This is similar to super-sourcing and can be solved similar and perhaps together.
Second purpose is for triggering generators and what most of the proposal are about.As Roberto and perhaps others have been bringing up, it is best to follow regular java code generation practices in GWT.That means for the long-term we can mostly rely on AnnotationProcessors.There are many advantages of that:1. Not GWT only - continue sharing code with server (JRE), client(GWT) and mobile(Android).
2. IDE support: IDE can trigger codegen (esp. for debugging)
2. IDE support: IDE can trigger codegen (esp. for debugging)My experience with this has been pretty poor, and running GWT with -gen is at least as useful.
--
John A. Tamplin
2. IDE support: IDE can trigger codegen (esp. for debugging)My experience with this has been pretty poor, and running GWT with -gen is at least as useful.Also, Super Dev Mode gives you access to all the generated code. You can either use the browser's debugger with SourceMaps turned on (which also allows you to set breakpoints in generated code), or you can browse the source code directly on the codeserver.It would be nice if we somehow got this working with an IDE, though.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.
CoffeeApp coffeeApp = objectGraph.get(CoffeeApp.class);
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-co...@googlegroups.com.
Now that I understand it (hopefully), I think Ray's proposal is a good way to define new API's by writing Java wrappers that configure generated objects at runtime. Adding parameters to GWT.create() calls seems somewhat orthogonal as a way to pass arguments to generators at compile time.As often happens with language extensions, when you put them together, things get more complicated but also more expressive; if GWT.create() takes extra arguments then these should also be literals that you can accept in a user-defined create method.
There aren't really two concepts: you can mix and match generate-with and replace-with for the same type, and/or switch from one to the other over time.
Actually, replace-with is only a shorthand for a generator returning a constant value (of a class that already exists).
Even though the current form is pretty flexible and you can mix and match the two, it doesn't mean it makes sense to do so. I'm having hard time thinking about out a good use case that would make a single complex mix and match more appealing than having a separate group of class replacements and a codegen (AFAIK, there is not even single example in the GWT-SDK itself). Actually separating the two can result in something much more useful&powerful [*].
On Fri, Aug 9, 2013 at 7:16 PM, Goktug Gokdogan <gok...@google.com> wrote:
I think in the long-run we should separate the two concepts that is being tackled by GWT.create today.First purpose is the class replacement, especially used by permutations. I think this one should not have anything to do with GWT.create. We can do any class replacement in compiler without requiring a call to GWT.create. This is similar to super-sourcing and can be solved similar and perhaps together.I don't see how it is similar to super-sourcing, as you need to dynamically select which class goes on there. For example, think about implementing GWT.create(SomeLocalizableSubclass). There are hundreds of locales, and different classes are going to have different implementations so you have to make the substitution decision for each one of them separately.Are you proposing to hook new Foo and substituting the class? Where does the compiler get the knowledge to know which class to substitute? I don't think you want to build all the knowledge of the ClientBundle generator into the compiler, for example.
Second purpose is for triggering generators and what most of the proposal are about.As Roberto and perhaps others have been bringing up, it is best to follow regular java code generation practices in GWT.That means for the long-term we can mostly rely on AnnotationProcessors.There are many advantages of that:1. Not GWT only - continue sharing code with server (JRE), client(GWT) and mobile(Android).You can use shared.GWT.create today in all those environments.
2. IDE support: IDE can trigger codegen (esp. for debugging)My experience with this has been pretty poor, and running GWT with -gen is at least as useful.
--
John A. Tamplin--
2. IDE support: IDE can trigger codegen (esp. for debugging)My experience with this has been pretty poor, and running GWT with -gen is at least as useful.Also, Super Dev Mode gives you access to all the generated code. You can either use the browser's debugger with SourceMaps turned on (which also allows you to set breakpoints in generated code), or you can browse the source code directly on the codeserver.It would be nice if we somehow got this working with an IDE, though.
--
--
John A. Tamplin
An example use-case would be implementing String.format when the format string is a compile-time constant. I had a proof of concept mostly working for this, but it was going to require more surgery to the compiler than I was willing to do at the time.
I didn't fully understand the example but it sounds like it requires way more than today's deferred binding so I'm not sure it is a good use case with replace-with/generate-with and static selectors. Perhaps it should be better done with something like "evaluate-with" instead. Actually, evaluate-with sounds interesting - I'll think about it :)
--
--