michaelwiles / google-gin

Automatically exported from code.google.com/p/google-gin
Apache License 2.0
0 stars 0 forks source link

Gin without strings #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Follow up on discussion here:
http://groups.google.com/group/google-gin/browse_thread/thread/a182319d8b17c73c

Basically, we could get rid of @Modules("...") by mirroring some Guice
interfaces to corresponding types like GModule, GProvider and so on. For
the generator, or to reuse client code on the backend, we can write
adapters for those classes.

Proof of concept attached in the patch.

Wins:
- Gradually move towards the Guice API without having to include methods
that don't work.
- No more string identifier to specify modules. I know it gets validated at
GWT compile time, but GWT compile time is usually not IDE compile time.
- No more awkward "rebind" package to put the Module in. Having these
different worlds separated by convention feels ugly.
- 100% client to server compatibility using the module adapter.
- Ability to extend the Guice DSL to address GWT specific needs, e.g.
intercepting private methods/interfaces
- Documents the fact (GModule API name) that the module could behave
differently depending on where you use it. For example a class might work
with GWT.create but not on the backend.

Losses:
- Code shared by client and server needs to be in a GModule.
- G's: GModule, GProvider.

Let's discuss.

Original issue reported on code.google.com by robbie.v...@gmail.com on 12 Sep 2008 at 12:43

Attachments:

GoogleCodeExporter commented 9 years ago
Hmm, I just realized that support for bindings to provider types is not going 
to be
easy if you want to use Guice's visitors internally. Will investigate further.

Original comment by robbie.v...@gmail.com on 12 Sep 2008 at 1:49

GoogleCodeExporter commented 9 years ago
Allright, I think I figured it out. Besides a single type parameter I didn't 
need
changes in the existing code, which I think proves the point! Patch attached.

Original comment by robbie.v...@gmail.com on 12 Sep 2008 at 3:49

Attachments:

GoogleCodeExporter commented 9 years ago
Minor update.

Original comment by robbie.v...@gmail.com on 12 Sep 2008 at 4:22

Attachments:

GoogleCodeExporter commented 9 years ago
Improved patch accepted in r33.

Original comment by robbie.v...@gmail.com on 27 Sep 2008 at 12:33