Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign uplib: name anonymous callbacks #21412
Conversation
nodejs-github-bot
added
http
stream
tls
labels
Jun 19, 2018
Trott
reviewed
Jun 19, 2018
| @@ -240,7 +240,7 @@ exports.translatePeerCertificate = function translatePeerCertificate(c) { | |||
| c.infoAccess = Object.create(null); | |||
|
|
|||
| // XXX: More key validation? | |||
| info.replace(/([^\n:]*):([^\n]*)(?:\n|$)/g, function(all, key, val) { | |||
| info.replace(/([^\n:]*):([^\n]*)(?:\n|$)/g, function replacerCallback(all, key, val) { | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
mlrv
Jun 20, 2018
•
Author
Contributor
It wasn't a typo in my head. I suppose that it makes sense in both versions:
replacerCallback-> the replacer function (insidereplace)replaceCallback-> the callback of thereplacefunction
Happy to change it of course
This comment has been minimized.
This comment has been minimized.
Trott
Jun 20, 2018
Member
Nah, if it wasn't a typo, it's fine with me. Just wanted to give you the opportunity to fix it up if it was a mistake.
starkwang
approved these changes
Jun 20, 2018
trivikr
approved these changes
Jun 20, 2018
This comment has been minimized.
This comment has been minimized.
trivikr
added
the
author ready
label
Jun 20, 2018
benjamingr
approved these changes
Jun 20, 2018
|
Thanks for doing this and following up! |
This comment has been minimized.
This comment has been minimized.
|
Glad to see it all seems to go well :) If I understood correctly, the standard process is to wait at least 48 hours before merging, am I right? Is there anything else that needs to be done? |
This comment has been minimized.
This comment has been minimized.
|
@mlrv that is correct, we can fast track this one though since it's naming rather than functionality. This is all explained here: https://github.com/nodejs/node/blob/master/COLLABORATOR_GUIDE.md#waiting-for-approvals . It also explicitly states that since this is a Collaborators |
BridgeAR
approved these changes
Jun 20, 2018
BridgeAR
added
the
fast-track
label
Jun 20, 2018
This comment has been minimized.
This comment has been minimized.
|
CI again to try to confirm Windows failure is unlikely to be related: https://ci.nodejs.org/job/node-test-pull-request/15538/ |
lpinca
approved these changes
Jun 20, 2018
jasnell
approved these changes
Jun 21, 2018
This comment has been minimized.
This comment has been minimized.
|
Hmmm... let's try a total re-run: |
apapirovski
requested changes
Jun 25, 2018
|
Hi @mlrv — thank you for working on this. In my opinion naming should provide some value, rather than just being decorative. Names such as |
| @@ -721,7 +721,7 @@ Readable.prototype.pipe = function(dest, pipeOpts) { | |||
| }; | |||
|
|
|||
| function pipeOnDrain(src) { | |||
| return function() { | |||
| return function pipeOnDrainInner() { | |||
This comment has been minimized.
This comment has been minimized.
apapirovski
Jun 25, 2018
Member
pipeOnDrainCallback? It won't be "inner" by the time it's in a stack trace.
| @@ -185,7 +185,7 @@ OutgoingMessage.prototype.setTimeout = function setTimeout(msecs, callback) { | |||
| } | |||
|
|
|||
| if (!this.socket) { | |||
| this.once('socket', function(socket) { | |||
| this.once('socket', function socketOnceCallback(socket) { | |||
This comment has been minimized.
This comment has been minimized.
| @@ -202,7 +202,7 @@ OutgoingMessage.prototype.destroy = function destroy(error) { | |||
| if (this.socket) { | |||
| this.socket.destroy(error); | |||
| } else { | |||
| this.once('socket', function(socket) { | |||
| this.once('socket', function socketOnceCallback(socket) { | |||
This comment has been minimized.
This comment has been minimized.
| @@ -240,7 +240,7 @@ exports.translatePeerCertificate = function translatePeerCertificate(c) { | |||
| c.infoAccess = Object.create(null); | |||
|
|
|||
| // XXX: More key validation? | |||
| info.replace(/([^\n:]*):([^\n]*)(?:\n|$)/g, function(all, key, val) { | |||
| info.replace(/([^\n:]*):([^\n]*)(?:\n|$)/g, function replacerCallback(all, key, val) { | |||
This comment has been minimized.
This comment has been minimized.
apapirovski
Jun 25, 2018
Member
Switch to an anonymous function instead of naming it? The function name is not particularly useful.
This comment has been minimized.
This comment has been minimized.
Trott
Jun 26, 2018
Member
I thought there was consensus that naming anonymous callback functions was helpful. If that's not the case, I should update #8913 (comment).
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
apapirovski
Jul 29, 2018
Member
My bad here as far as dropping the ball and misphrasing. What I meant to say is: I think this should just be an arrow function. I don't think we gain much by naming callbacks for things like String.prototype.replace.
This comment has been minimized.
This comment has been minimized.
mlrv
Jul 29, 2018
Author
Contributor
I implemented the suggestions and fixed the conflicts. Happy to go ahead if all the checks are green?
This comment has been minimized.
This comment has been minimized.
|
Hi @apapirovski, thanks for the feedback, I totally see your point. Happy to change the names if you think those could be more helpful. On the last comment, not sure I agree with you, what do other people think? |
addaleax
removed
author ready
fast-track
labels
Jul 13, 2018
maclover7
added
the
work in progress (WIP)
label
Jul 28, 2018
apapirovski
reviewed
Jul 30, 2018
| @@ -240,7 +240,7 @@ exports.translatePeerCertificate = function translatePeerCertificate(c) { | |||
| c.infoAccess = Object.create(null); | |||
|
|
|||
| // XXX: More key validation? | |||
| info.replace(/([^\n:]*):([^\n]*)(?:\n|$)/g, function (all, key, val) { | |||
| info.replace(/([^\n:]*):([^\n]*)(?:\n|$)/g, function(all, key, val) { | |||
This comment has been minimized.
This comment has been minimized.
apapirovski
approved these changes
Jul 30, 2018
This comment has been minimized.
This comment has been minimized.
|
@benjamingr all green, good to go? :) |
benjamingr
added
the
author ready
label
Jul 30, 2018
This comment has been minimized.
This comment has been minimized.
Trott
dismissed
their
stale review
Aug 1, 2018
not sure about the arrow function fitting in with the rest but won't block
This comment has been minimized.
This comment has been minimized.
|
Weird. CI failed on git due to a conflict. Let's try again... |
This comment has been minimized.
This comment has been minimized.
|
GitHub says this has no conflicts with the base branch, but manually trying to apply the changes shows conflicts. I'll resolve them, push back up, and restart CI. |
mlrv
added some commits
Jun 19, 2018
Trott
force-pushed the
mlrv:marco/issue-8913
branch
from
760ec4c
to
b1e3dc1
Aug 1, 2018
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Might be good for people to double-check the changes now that I've done a rebase and resolved conflicts. |
maclover7
approved these changes
Aug 3, 2018
maclover7
removed
the
work in progress (WIP)
label
Aug 3, 2018
This comment has been minimized.
This comment has been minimized.
|
Resume Build: https://ci.nodejs.org/job/node-test-pull-request/16165/ |
maclover7
added a commit
that referenced
this pull request
Aug 4, 2018
This comment has been minimized.
This comment has been minimized.
|
Landed in d7496bf, congrats on your first PR to Node.js! |
mlrv commentedJun 19, 2018
First contribution here!
This commit is to help in the effort to name all anonymous
functions to help when heap debugging. Specifically, this commit
fixes some anonymous functions used as listeners in the lib/ folder.
Refs: #8913
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes