Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

refactor(injector): remove unused code #8273

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pomerantsev
Copy link
Contributor

The removed code isn't being used:

  • there isn't a single place in the code where invoke would be
    called with a string argument in the third position.
  • the fourth parameter is also not documented,
    so when called from outside of the framework's source,
    the third parameter is meant to be the locals object.

@mary-poppins
Copy link

Thanks for the PR! Please check the items below to help us merge this faster. See the contributing docs for more information.

  • Uses the issue template (#8273)

If you need to make changes to your pull request, you can update the commit with git commit --amend.
Then, update the pull request with git push -f.

Thanks again for your help!

@caitp
Copy link
Contributor

caitp commented Jul 20, 2014

This is really a convenience for 3rd party libraries which use the smart-injector style for providing more debug information. I don't feel good about breaking that just because we don't use it internally. It's not clear whether anyone is actually using it yet, but they might at some point

@pomerantsev
Copy link
Contributor Author

Thanks for your quick response!
I've changed the commit according to it.
This was something that tripped me up when I was looking at the source code, so I feel that saying a couple of words about it in the docs won't do any harm.
If you feel otherwise, I'm okay with closing this PR.

@caitp
Copy link
Contributor

caitp commented Jul 20, 2014

well hang on, maybe the original PR isn't a bad idea. I'm thinking about it.

@pomerantsev
Copy link
Contributor Author

Okay - please let me know.

@al-the-x
Copy link
Contributor

@caitp Can you explain how a 3rd party library might actually use this functionality?

@caitp
Copy link
Contributor

caitp commented Jul 21, 2014

It's just a simpler way to call it, for instance $injector.invoke(someFn, 'DescriptiveNameForWhatSomeFnIs');

Obviously this is in the slot for locals, but it's convenient to be able to call the function with 2 params rather than three (however, I'm not sure if this is really all that great, it might be better to not support the case where locals is a string).

But basically what it does is provides some extra metadata about the service being instantiated or invoked, in order to make it easier to find where the problem lies.

@pomerantsev
Copy link
Contributor Author

Okay - @caitp - would you like me to remove those first three lines from injector.invoke()?
Personally, I don't feel they add to the API's consistency, but I'm totally leaving this up to you.

@al-the-x
Copy link
Contributor

Ah, as is done in unit testing, typically. Seems like just passing an empty
object literal as the locals dictionary isn't overly painful, though. If
documented, I can see the utility, but having it both ways seems like
over-engineering to me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants