2009/3/2 Witold Szczerba <[email protected]>

>
> Hi there,
> I was reading this thread and there is one thing I don't understand.
>
> 2009/2/28 [email protected] <[email protected]>:
> > You can't bind anything that's already bound in your parent. Otherwise
> > there's a conflict, since you naturally inherit bindings from your
> > parent.
>
> We have 2 private modules here, first one exposes String, secound one
> does not, but it declares local dependency on String class for its own
> need. I do not understand why private module is not allowed for
> _local_ binding only because that binding was exposed by some other
> module. If some local module depends locally on something and does not
> expose that "something" then why does it clash with some other module?
> It looks like those two totally independent modules are indirectly
> coupled (they are two separate, independent modules but cannot work
> together).
>

Enforcing this rule makes the system much, much easier to reason about
and protects you from unexpected problems, such as in Jesse's example.

If the rule was relaxed then it would also be harder to explain - "you
inherit
bindings from your parent, unless you have a local binding, except if your
using a just-in-time binding, etc. etc..."

What if I want my binding for Wibble to be used everywhere in the app?

Imagine I am writing application using Guice. Everything works fine,
> but one day I decide to use some 3rd party library. This library uses
> Guice to wire itself and exposes only public stuff. Now I am creating
> new, empty project to see if that library works as I am expecting and
> everything is fine until I use it in my real project. What happens?
> That 3rd party lib uses __internally__ some binding which happens to
> be one of my global binding. Why, on Earth, some internal stuff of
> that library goes into collision with my project's stuff?
>

>From my perspective you only need to expose bindings that you expect
(and want) other modules to use. So I'd personally see this as advance
warning of an incompatibility between the 3rd party module and the app.

Otherwise your code might be running fine in production for several days
before you suddenly get an error because the 3rd party binding has been
used where you expected your own binding to be used...

Regards,
> Witold Szczerba
>
> >
>


-- 
Cheers, Stuart

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to