create_instance_provider question

13 views
Skip to first unread message

Bill Tutt

unread,
Aug 2, 2012, 11:14:51 PM8/2/12
to snake...@googlegroups.com
Was there any particular reason for having create_instance_provider always return the non-instantiated DynamicInstanceProvider?
Clearly the binder needs to support instantiating providers that aren't instances, but I can't quite follow why you wouldn't want to pre-instantiate the provider.

Does it have something to do with supporting the LazyBinding (i.e. more tool oriented usages)

Thanks,
Bill

David Stanek

unread,
Aug 5, 2012, 1:30:15 PM8/5/12
to snake...@googlegroups.com
I don't think there is any real reason why it is like that. It would
work equally as well if it created an instance of
DynamicInstanceProvider and returned that. It would be slightly more
efficient because the object wouldn't need to be created each time.

Are you just curious about the implementation or is this causing issues for you?
> --
> You received this message because you are subscribed to the Google Groups
> "snake-guice" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/snake-guice/-/uDxSMrDA9oAJ.
> To post to this group, send email to snake...@googlegroups.com.
> To unsubscribe from this group, send email to
> snake-guice...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/snake-guice?hl=en.



--
David
blog: http://www.traceback.org
twitter: http://twitter.com/dstanek
www: http://dstanek.com

Bill Tutt

unread,
Aug 5, 2012, 3:51:15 PM8/5/12
to snake...@googlegroups.com
I'm using Snake Guice for the first time in a wxPython UI application that drives a data collection engine for a tech support tool.
The data collection engine is using Snake Guice in order to inject pre-collected data for integration testing test cases. (among other things)

I was trying to understand the code while writing the fixes for issue 11 and 16. (which are attached to the issues)
I was additionally confused since an older version of the code did use only one copy of the class. (as opposed to being inside the method)

Thanks,
Bill


On Sunday, August 5, 2012 1:30:15 PM UTC-4, David Stanek wrote:
I don't think there is any real reason why it is like that. It would
work equally as well if it created an instance of
DynamicInstanceProvider and returned that. It would be slightly more
efficient because the object wouldn't need to be created each time.

Are you just curious about the implementation or is this causing issues for you?

On Thu, Aug 2, 2012 at 11:14 PM, Bill Tutt  wrote:
> Was there any particular reason for having create_instance_provider always
> return the non-instantiated DynamicInstanceProvider?
> Clearly the binder needs to support instantiating providers that aren't
> instances, but I can't quite follow why you wouldn't want to pre-instantiate
> the provider.
>
> Does it have something to do with supporting the LazyBinding (i.e. more tool
> oriented usages)
>
> Thanks,
> Bill
>

--
Reply all
Reply to author
Forward
0 new messages