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

named anonymous functions in readline & zlib.js #21792

Closed
wants to merge 1 commit into from

Conversation

antsmartian
Copy link
Contributor

@antsmartian antsmartian commented Jul 13, 2018

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added readline Issues and PRs related to the built-in readline module. zlib Issues and PRs related to the zlib subsystem. labels Jul 13, 2018
Copy link
Member

@apapirovski apapirovski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @antsmartian, the goal of naming these functions should be to make a more useful name than the anonymous one. Please try to consider the use cases for these functions and name based on that. In particular this applies to fnWrap.

@antsmartian
Copy link
Contributor Author

Yeah sure. Will do the same and update.

@antsmartian
Copy link
Contributor Author

@apapirovski Ok, I did skimmed the source code of zlip.js, looks like we can use syncBufferWrapper, as this function just returns the zlibBufferSync and used for different compression formats like gzip, gunzip etc in sync mode. Similary, for zlibBuffer, we can name it as asyncBufferWrapper as the implementation of zlibBuffer is based on event emitters (async). Let me know if I'm wrong otherwise here.

For SIGCONT, I better rename the function to be continueProcess, as I guess that suits more natural. Thanks.

@@ -843,7 +843,7 @@ Interface.prototype._ttyWrite = function(s, key) {
if (this.listenerCount('SIGTSTP') > 0) {
this.emit('SIGTSTP');
} else {
process.once('SIGCONT', (function(self) {
process.once('SIGCONT', (function continueProcess(self) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we could actually do a slightly better thing here. Instead of the IIFE, we could use an arrow function and replace self with this — unless I'm missing something. Then we will just have a normal event callback instead of this weird thing it is right now. Feel free to either do that change here or in a separate PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that make sense, may be will update the same in another PR. Thanks for your time on this.

@trivikr
Copy link
Member

trivikr commented Jul 16, 2018

Thank you @antsmartian for your first PR in Node.js core!

The user.email needs to be updated in the commit as specified in this step
The current user.email is not registered with Github

@antsmartian
Copy link
Contributor Author

@trivikr Thanks, for some reason, my git config wasn't correct. Now fixed.

@trivikr
Copy link
Member

trivikr commented Jul 18, 2018

@apapirovski
Copy link
Member

@apapirovski apapirovski added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jul 29, 2018
@maclover7
Copy link
Contributor

Resumed CI: https://ci.nodejs.org/job/node-test-pull-request/16082/

@maclover7
Copy link
Contributor

Resumed once again, infrastructure issue on OSX: https://ci.nodejs.org/job/node-test-pull-request/16141/

@trivikr
Copy link
Member

trivikr commented Aug 2, 2018

Landed in fc6f49a

@trivikr trivikr closed this Aug 2, 2018
trivikr pushed a commit that referenced this pull request Aug 2, 2018
PR-URL: #21792
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yuta Hiroto <hello@hiroppy.me>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
targos pushed a commit that referenced this pull request Aug 2, 2018
PR-URL: #21792
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yuta Hiroto <hello@hiroppy.me>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
@antsmartian antsmartian deleted the anonymous_functions branch August 4, 2018 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. readline Issues and PRs related to the built-in readline module. zlib Issues and PRs related to the zlib subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants