-
Notifications
You must be signed in to change notification settings - Fork 104
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
Make variable names more descriptive #13
Comments
I'm am strongly opposed to this suggestion based on the principle of least surprise. If we start with the suggested names and explain why it's better to name things as others expect, that might be okay. |
Data point from 12/14/16: developer question, "are resolve and reject [variables] a part of a Promise"? I verified with the student; he indeed did not understand that they were variables, even though we have been using Promises for almost a week. |
They have a strong conventional meaning in JS. They're directly analogous to
In this context, I'm not sure saying they are "variables" is particularly helpful. Everything with a name is variable (this is an overgeneralization to serve my point); I think it's better to get developers thinking about what kinds of things lie behind pointers. In this case, |
Because
resolve
andreject
are the variable names use in the Promises documentation, some developers are interpreting these terms to be key terms with designated meaning in JS. It would be helpful to rename them to something more explicit to make clear that these are other functions that we are writing/have written.I would propose
runResolve
andrunReject
, or perhapsdoThisIfResolved
anddoThisIfRejected
The text was updated successfully, but these errors were encountered: