Skip to content

Comments

Fix circular dependency issues. Fix instances being "filled" multiple times#3

Merged
ChrisSandison merged 1 commit intomainfrom
more-fixes
Mar 9, 2024
Merged

Fix circular dependency issues. Fix instances being "filled" multiple times#3
ChrisSandison merged 1 commit intomainfrom
more-fixes

Conversation

@kbirk
Copy link
Collaborator

@kbirk kbirk commented Mar 9, 2024

Of course I introduce the recursive filling without realizing that:

A) It was re-filling previously instantiated singleton types
B) It introduces the possibility of filling infinite cycles, deadlocking on singletons and stack overflowing on instances.

This PR fixes both of those.

A) Singleton types will only ever be "filled" once.
B) Injection now gracefully handles cyclical objects, in the case of instances, the values are cached each that injection so resolve them.

The only outward change is that we can no longer create provider that returns structs by value. There is no benefit in doing so, since that is what the Instance registration is for anyway.

@kbirk kbirk requested a review from ChrisSandison March 9, 2024 16:45
@ChrisSandison ChrisSandison merged commit 4094a36 into main Mar 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants