Thanks Thomas for the idea. It's an excellent one and we should
definitely pursue it in gin.

However, I'd like to probe the Guice developers on this a little more
as I feel that the ability to annotate abstract types with a scope
could be useful in other contexts as well. For example I'm using Guice
SPI in Jukito in order to automatically mock non-bound abstract types.
If the scope annotation was on the abstract type (rather than the
implementation) it would give a clear indication to Jukito as to
whether or not the type is expected to be a Singleton.

I guess that, bottom line, my question is:
Shouldn't the default scope be an attribute of the type rather than
the implementation?

For example: should any implementation of EventBus be bound as a
@Singleton by default? Should any implementation of HttpSession be
bound as @Session by default? etc.

Cheers!

    Philippe


On Thu, Jan 27, 2011 at 2:24 AM, Thomas Broyer <t.bro...@gmail.com> wrote:
> [cc: google-gin group]
> Phil,
> to make it clearer on the GIN side, how about a GinScope annotation taking
> as value a scope annotation, and having GIN use that scope annotation when
> JIT-binding to the GWT.create() call?
> I.e.
> @GinScope(@Singleton)
> public interface MyRequestFactory extends RequestFactory {
> ...
> }
> and GIN would then create the following binding (sort of):
> bind(MyRequestFactory.class).toProvider(new
> GwtDotCreateProvider(MyRequestFactory.class)).in(Singleton.class)
> Or, because GIN doesn't support custom scopes (yet!), simply have a
> @GinSingleton or @GwtDotCreateSingleton annotation (that's not a Guice
> @ScopeAnnotation).
>
> --
> You received this message because you are subscribed to the Google Groups
> "google-gin" group.
> To post to this group, send email to google-...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-gin+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-gin?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To post to this group, send email to google-guice@googlegroups.com.
To unsubscribe from this group, send email to 
google-guice+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to