I hate dynamic proxies too. =D Fwiw, I agree with Sam that a strategy for lazy singletons is needed (across the board). Tests can easily exercise on-demand singletons, but declaratively making a singleton lazy in prod is very useful.
This comes up a fair bit internally too, that I think it's worth supporting for Guice 2. Dhanji. On Thu, Apr 9, 2009 at 10:34 AM, [email protected] <[email protected]>wrote: > > Sam, this is very nice work. > > Lack of support for lazy singletons in Stage.PRODUCTION is a Guice > weakness. I'm curious if this is a general problem, or one that only > comes up when singletons are used aggressively for initialization, > like in your app. We don't have them in our apps at Google and so far > there hasn't been much complaining. But we're writing server-side > apps, where eager initialization and slow start-up aren't major > concerns. > > I particularly like how you're using aggressive scope checks in > LazyBinder.registerAndCheckTypes(). The compareAndSet() call is also > handy to ensure you only get a single instance. Nice work. > > I'm semi-reluctant to include all of this is in core Guice, because I > find that dynamic proxies can cause confusion in debugging I have the > same problem with EasyMock. I'm also anxious about the tradeoffs > between lazy instantiation (great!) and proxying everything (not so > great!). > > For now, I've posted a link here from our Scopes wiki: > > http://groups.google.com/group/google-guice/browse_thread/thread/e34e475609c2cec4 > > Cheers, > Jesse > > PS - I admit that I'm a horrible hypocrite for giving dynamic proxies > much love in AssistedInject. > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "google-guice" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-guice?hl=en -~----------~----~----~----~------~----~------~--~---
