Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Allow circular dependency for singletons. #16

Merged
merged 1 commit into from Mar 9, 2012

Conversation

Projects
None yet
2 participants
Contributor

MattesGroeger commented Mar 9, 2012

With this change I added support for circular dependencies (at least singletons). I solved it by adding the newly created object to the _storageCache before wiring with all its dependencies. This way if the dependency references back, it will get the already created object. Before, it ended up in an endless loop because it was added to the cache afterwards.

The change is covered in the CircularDependenciesSpec.m. In order to have cross-referencing test objects I had to create another fixture file (CircularDependencyFixture).

Contributor

thestoics commented Mar 9, 2012

Ah, yes. This was on a TODO of mine. Thanks for doing it. I'll merge the request.

thestoics added a commit that referenced this pull request Mar 9, 2012

Merge pull request #16 from MattesGroeger/master
Resolve circular dependencies between singletons.

@thestoics thestoics merged commit c2ef5b1 into atomicobject:master Mar 9, 2012

Contributor

thestoics commented Mar 10, 2012

I've added issue #17 to deal with resolving all dependencies before notifying an object that it is ready when dealing with circular dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment