enowars / enochecker3

MIT License
2 stars 1 forks source link

Allow overwriting default dependency injectors with same return type #18

Closed ldruschk closed 1 year ago

sinitax commented 2 years ago

Currently the return type annotation is the only way of knowing which dependency to inject. If we also use the parameter name then this must be parsable from the getter function sig like "_get_dependency_io_Session" for a parameter name of "io" with return type "Session". Specifying only the parameter name would cause problems with parameters of different types but same name (e.g. io: AsyncSocket and io: MyCustomSocket). Might be a bit restrictive, what do you think?

sinitax commented 2 years ago

Looks like you cant actually inspect the function name as I intended, passing the parameter name via decorator args seems like a better way to go about this anyways. Prototype in #27, waiting for CI to test. Thoughts? Would definitely need a version bump.