rodi icon indicating copy to clipboard operation
rodi copied to clipboard

ContainerProtocol.register returns self

Open tdg5 opened this issue 1 year ago • 1 comments

Y'all may have a reason for not defining the return type of ContainerProtocol.register, but if so, I didn't pick up on it.

Here I propose making ContainerProtocol.register return Self. This matches what Container.register does and allows a chaining of registrations of like

container.register(...).register(...).register(...)

Honestly, I don't care and am equally happy with None, but a tighter bound than Any seems beneficial to maintaining portability across container implementations.

tdg5 avatar Feb 18 '24 15:02 tdg5

Hi @tdg5 Sorry for replying so late. The reason why I didn't specify return self in the ContainerProtocol is only to keep simple the protocol that can be used to replace rodi with alternative implementations of DI in applications like BlackSheep apps. But I like your idea and I am considering to merge. Thank You!

RobertoPrevato avatar Apr 06 '24 06:04 RobertoPrevato