On Feb 28, 10:08 am, "[email protected]" <[email protected]> wrote:
> On Feb 28, 8:28 am, Alen Vrecko <[email protected]> wrote:
>
> > now notice in the second case that String has been exposed meaning
> > once a binding is created it is immutable and global for all i.e.
> > nobody is allowed to redefine it. This property of bindings makes it
> > possible for the module order to be in any way. If bindings could
> > overwrite each other then the order of modules would matter and that
> > is not very good idea.
So the rationale behind not allowing child's couplings to override the
parents coupling is:
<a> to not become dependent upon the order of module placement in the
injector's constructor arg list?
OR
<b> Simply avoid the feature to keep lookup simple.
I can buy the simplicity argument of <b> but am having trouble with
the <a> if its the case. Lets say for the time being Guice did alllow
child couplings to override parents couplings.
In that case Injector injector = Guice.createInjector(new ModuleOne
(),
new ModuleTwo(),
new LocalModule());
OR
Injector injector = Guice.createInjector(new LocalModule(),
new
ModuleTwo(),
new
ModuleOne());
shouldnt matter we have the same case where child conflicts with its
parents couplings and its time to make a decision whether to allow
this or not right?
>
> > LocalModule addes String to "global" bindings
> > ModuleOne addes String to "private" bindings but it CANNOT work
> > because it would redefine the "global" binding.
>
> > If you don't expose String in LocalModule it would work fine.
>
> Thanks Alen. I like your explanation better than mine!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---