On Mon, Mar 23, 2009 at 19:23, Stuart McCulloch <[email protected]> wrote:
> 2009/3/20 Endre Stølsvik <[email protected]>
>>
>> On Fri, Mar 20, 2009 at 01:32, Bob Lee <[email protected]> wrote:
>> > I assume you're talking about circular deps between constructors. This
>> > is a
>> > tough problem. Injecting proxies was an experiment that I don't really
>> > like
>> > to advertise.
>>
>> Good!
>>
>> But as a user of your tool, one will most certainly be bitten by them
>> at some point, so you will learn about them - the hard way.
>>
>> > In the long run, I think the best solution will be to
>> > generate an error when we encounter a circular dep. The solution to the
>> > error will be to inject a Provider<X> into one of the constructors or to
>> > move the dep into an injected method instead (not currently supported).
>>
>> Hear, hear!!
>>
>> I never liked those proxies, and one have no idea of them existing
>> until one suddenly get an error about accessing such a proxy. They are
>> not stable either, so those proxy-problems kinda come and go with
>> module-configuration changes. And amazingly, they cannot be resolved
>> by making a setter (what about field-injection?). Is this 3.0 stuff?
>
> I would've thought more likely 2.1 (or 2.x) as this wouldn't require a major
> API change

Failing to start if proxies would be needed are a kind of invasive API
change, wouldn't you think? I guess this have to be configurable, with
default on as in "do create proxies".

>
> do you perhaps have a test-case where you wouldn't expect a proxy, but do
> get one?

No, I don't - but I don't think this issue in any way isn't fully
understood. I just said "Yes!" and elaborated slightly on what I as a
user find un-good with it: It is not as I "wouldn't expect a proxy",
because the reason for getting it is very simple. It is that /where/
you get it is indeterministic: If A depends on B that needs A, then
where is the proxy inserted? Maybe one config would work, and another
not: By adding some pretty much unrelated bindings into the system,
you all of a sudden get a proxy-access-error because the order got
changed (the proxy is created for the other place). Also it is not
possible to break the cycle by inserting a setter on either A or B -
Guice blatantly still creates the proxy.

This is all "as I've understood it", but Bob effectively, IIUC, said
as much, which means that he know exactly where the situation lies.

Endre.

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