-
Notifications
You must be signed in to change notification settings - Fork 107
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
Add temp var to real-world examples #254
Conversation
Which examples do you find are less clear with pipes than with temp vars? |
|
Does the use of |
Besides maybe the first example, I disagree that any of the temp var versions are better. But more importantly, the README is intended to make the case for the operator, not just a collection of random comparisons. If there are examples that we don't think are improvements, we should probably remove them and replace them with better examples. |
I didn't actually know what
After reading this a better name is
IDE features like IntelliJ/WebStorm/VSCode's inlay hints may negate the need for named temp vars, but depending on IDE is not a good IDE. Lots of code is reviewed outside an IDE. |
It's literally named "jquery parse html" - i can't conceive of having any expectation of what jquery will return after parsing html besides a jquery wrapper object around DOM nodes. Can you help me understand why anyone with any jQuery experience will have a different expectation, and what that might be? |
Thanks for your work here. I’m going to go ahead and close this, since I don’t think any of the champions think comparing pipe code with both original code and temp-variable code is appropriate in the real-world examples section. I’m sorry if that’s disappointing; hopefully this is understandable. After all, the point of the real-world examples section is to compare this proposal with status-quo code. Adding a third version to each example would just be confusing. (We could arguably even omit the original versions from each example, since the primary purpose is to show the pipe operator in action.) In addition, there’s already a comparison with temp-var approaches in the “Why a pipe operator” section. A big point that it makes is that the examples’ original writers could have written their code with more temp variables but already chose not to, instead opting for deeply nested expressions, presumably for brevity. See also #211. We appreciate the time you took in helping out! Thank you again for your work. |
Added temp vars to real-world examples.
Related: #253
I I think it might be useful because for some examples it demonstrates the difficulty in finding an appropriate name (as mentioned in other issues), notably the functional programming examples. But then for other examples, it can be seen that things become less clear.