-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
http: convert var to let or const for http #26504
Conversation
I think we've generally avoided these kinds of commits/PRs and preferred to only update them if you're already affecting those variables because of other changes. |
@mscdex, thanks for letting me know. Should I then try A) or B) below? Happy to address either way. A) Revert everything except B) Just close this PR. |
I generally have no problem with these kinds of changes when done in batch. Lots of small changes like this get noisy. |
i don’t think these changes have more improvements, but add some noisy commits |
@himself65, while it’s true that there are no major improvements, there is an subtle improvement to use “const” over “var” as it will throw an error to “promote” immutability, if a “const” variable’s value is reassigned after its declaration. |
@BeniCheni |
@himself65, this is an actual follow-up per a suggestion from another PR, which is an actual change. (could be traced by 1st comment of this PR) The suggestion was to punt the var => let / const to a separate PR. |
I guess we might just go ahead and accept a couple PRs like this. Otherwise this is going to come up frequently and as soon as we are through with it, we do not have to worry about it anymore. I am aligned with @jasnell that we should do this as batched change. It is actually quite simple and straight forward to use eslint to auto fix these. Should we just do that? |
Would changes like this make |
@ZYSzys it adds one more step to find the actual author. Most tools I know / use allow to directly jump to the former blame as well, so I personally do not see this as a big downside anymore. |
I agree this. Also, I think it is better to add |
@nodejs/tsc PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work! I don’t think this is a good idea just yet. There is still a perf gap in Node 8 when using let, and we still have to do backports there till the end of the year.
Thanks for your time and feedback. I’m closing this PR to avoid potential further confusions. |
Refs #26486
Per this comment in #26486 ☝️ , this PR follows up to convert
var
variables tolet
orconst
, in the scope of http source inlib/
path.make -j4 test
(UNIX), orvcbuild test
(Windows) passes