-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New scope: WeakSingleton #49
Comments
Interesting. This seems like it would just boil down to singleton scope in the case where you are instantiating the entire object graph from a single root object - because, at the time of instantiation, there will always be a class using it. Are you thinking of using this alongside providers? |
No, I'm talking about Typhoon having an option to hold weak references to singletons. . . Let's say you have a helper component that's used in some view controllers (but not all). . . On mobile you want this to go away when you're not using it. |
Ahh, right. But to construct the view controller I assume you use a provider, or directly ask the block component factory? |
Directly asking the factory. . . and weak singleton would make it works as I expect, so I could avoid having to make a provider. |
Gotcha! The pedantic part of me wants to be as decoupled from the DI container as possible, so I'd probably go for the provider. :) It would be nice if narrow providers could be automatically generated somehow. Off the top of my head, I think Guice does this. |
Do you have a code-snippet of what that looks like? |
Closing . . . I put a typo in the title, and its not updating. . . re-opening as a new issue. |
Not sure which issue is the new issue, but to answer your question, without using objective c++ and templates, we'd need to autogenerate some code like:
along with a setter implementation of the setAssembly: method in < TyphoonInjectionAware >. |
This scope will:
The text was updated successfully, but these errors were encountered: