Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Register function name is overused #432

Closed
glibsm opened this issue Mar 21, 2017 · 4 comments
Closed

Register function name is overused #432

glibsm opened this issue Mar 21, 2017 · 4 comments

Comments

@glibsm
Copy link
Collaborator

glibsm commented Mar 21, 2017

There are currently three usages of function Register which have entirely different applications:

  1. dig.Register inserts into the dependency graph.
  2. task.Register registers a function into the async task module, or an interface implementation.
  3. dispatcher.Register registers []transport.Procedure for YARPC.

Two out of the three are under UberFx control, one comes from YARPC.

An earlier suggestion was to rename dig.Register to dig.Provide. I am now in favor of the change to try and break up the overloaded word.

@madhuravi
Copy link
Contributor

What makes this confusing? Each function is in the context of its own package (dig/task/dispatcher), has different arguments. It should be clear to the user from context/arguments/comments what it's doing.

@HelloGrayson
Copy link
Contributor

I suggest renaming dig.Register to dig.Provide.

Provide is much more inline with what is actually occurring: a user is providing a type or constructor to the container, so that the object graph can be built.

Provide is much more specific, and a better name AFAICT.

@madhuravi
Copy link
Contributor

I see. Register seems that way to me - a user is registering a type or constructor with the container, so that the object graph can be built.
Another commonly used function is "Run", it is clear what it is though, makes sense that it's used frequently.
So this doesn't get missed, pasting again - What makes this confusing? Each function is in the context of its own package (dig/task/dispatcher), has different arguments. It should be clear to the user from context/arguments/comments what it's doing.

@HelloGrayson
Copy link
Contributor

Closing - the modular branch, and soon dev, doesn't use the "Register" terminology in its API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants