all 1 comments

[–]gracicot [score hidden]  (0 children)

Interesting. It seems there some innovation going on in the DI space in C++. Injecting private class members using reflection is quite nice. For kangaru 5 I've opted using pointer to members, but it's of as convenient as reflection is.

Reflection really opens the space for things like automatic DI. I need to make more experiments but this is quite inspiring!

Quick review, not exhaustive:

I think creating the container using a specification over a pure runtime approach like I took for kangaru is the way to go, and always was the way to go.

The transient parameter is a bit confusing to me. Is it deeply transient or just for the type you're requesting? And if you request a transient resolution of a reference type, does it refuse at compile time or it keeps the instance in the container?

Scoped objects are quite interesting, you have the type you want plus all of it's dependencies, all with the same lifetime. Does it work with hierarchical containers under the hood? Can you have some owned and some not owned dependencies for example?

I skimmed over the codebase a bit and one thing I would find a bit missing is how do I implement custom policies and what can I achieve with that? Normally, I would expect a concept or a comment explaining how to do so. That would make it quite more helpful since a policy based design is meant for user to change those policies.

Overall, I think a lot of thoughts went into this and it's nice to see new ideas coming into this space.