FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

repl: deprecate REPLServer.parseREPLKeyword by lance · Pull Request #14223 · nodejs/node · GitHub

/ node Public

repl: deprecate REPLServer.parseREPLKeyword - #14223

Closed
lance wants to merge 5 commits into
nodejs:masterfrom
lance:7619-repl-keyword-deprecation
Closed

repl: deprecate REPLServer.parseREPLKeyword#14223
lance wants to merge 5 commits into
nodejs:masterfrom
lance:7619-repl-keyword-deprecation

Conversation

lance commented Jul 13, 2017
edited by refack
Loading

Copy link
Copy Markdown
Member

This method does not need to be visible to user code. It has been
undocumented since it was introduced which was perhaps v0.8.9, as
far as I can tell.

The motivation for this change is that the method is simply an
implementation detail of the REPLServer behavior, and does
not need to be exposed to user code.

This change adds documentation of the method with a deprecation
warning as recommended by @jasnell in
#7619 (comment).

Refs: #7619

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

repl, doc

nodejs-github-bot added the repl Issues and PRs related to the REPL subsystem. label Jul 13, 2017

refack left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

You should add a test that using this function raises the deprecation warning
Ref:

common.expectWarning('DeprecationWarning', warn);

lance commented Jul 14, 2017

Copy link
Copy Markdown
Member Author

@refack test added

Comment thread doc/api/repl.md Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Nit: (can be done while landing) XXXX should be REPLACEME

refack commented Jul 14, 2017
edited
Loading

Copy link
Copy Markdown
Contributor

FWIW: https://ci.nodejs.org/job/node-test-commit/11116/
(also ticked the tests and/or benchmarks are included box)

refack commented Jul 14, 2017

Copy link
Copy Markdown
Contributor

lint:

not ok 2 - /usr/home/iojs/build/workspace/node-test-linter/test/parallel/test-repl-deprecations.js
  ---
  message: Too many blank lines at the end of file. Max of 0 allowed.
  severity: error
  data:
    line: 22
    column: 1
    ruleId: no-multiple-empty-lines
  ...

lance commented Jul 16, 2017

Copy link
Copy Markdown
Member Author

Comment thread lib/repl.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Perhaps rather than passing repl in as an argument, restructure this to assume this === repl ... such that in the util.deprecate call above you can do:

util.deprecate(_parseREPLKeyword, '...', '...');

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Wouldn't that just introduce another property on the class?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@lance You can do .call().

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@TimothyGu sure, but how is that any better than what is there now? Wouldn't that mean doing something like this?

REPLServer.prototype.parseREPLKeyword = util.deprecate(
  function(keyword, rest) {
    return _parseREPLKeyword.call(this, keyword, rest);
  }, 'REPLServer.parseREPLKeyword() is deprecated', 'DEP0XX');

I don't see how this improves the code. Is .call() inherently faster?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

No, in that case you can just

REPLServer.prototype.parseREPLKeyword =
    util.deprecate(_parseREPLKeyword,
                   'REPLServer.parseREPLKeyword() is deprecated', 'DEP0XX');

Or am I missing something?

Comment thread test/parallel/test-repl-deprecations.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

There should be only one call to common.expectWarning(). The deprecation warning is only going to be emitted once. What calling common.expectWarning() twice does is set up two identical listeners for the process.on('warning') event that is only emitted once.

lance Jul 18, 2017
edited
Loading

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I have a local change with only a single call to common.expectWarning(). But what I find confusing is that the tests pass whether there is one or two calls to this. Does common.expectWarning() not fail if the warning isn't issued?

lance commented Jul 18, 2017

Copy link
Copy Markdown
Member Author

@jasnell made changes per your request. PTAL.

lance commented Jul 27, 2017

Copy link
Copy Markdown
Member Author

Ping @jasnell - it needs a rebase on deprecations.md but otherwise, just following up here...

Comment thread test/parallel/test-repl-deprecations.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Why separate these out into separate functions like this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Only the assumption that there may be future deprecations tests, and the test() function would run them all. I have no particular affinity for this approach though.

jasnell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

In general, this looks ok, but the test could use a bit of reworking. LGTM overall tho.

lance added 5 commits August 2, 2017 13:57
This method does not need to be visible to user code. It has been
undocumented since it was introduced which was perhaps v0.8.9, as
far as I can tell. This change is as recommended by @jasnell in
#7619 (comment).
This change is only for `parseREPLKeyword()`.

lance commented Aug 2, 2017

Copy link
Copy Markdown
Member Author

Landed in 766506a

lance closed this Aug 2, 2017
lance deleted the 7619-repl-keyword-deprecation branch August 2, 2017 18:43
lance added a commit that referenced this pull request Aug 2, 2017
This method does not need to be visible to user code. It has been
undocumented since it was introduced which was perhaps v0.8.9.

The motivation for this change is that the method is simply an
implementation detail of the REPLServer behavior, and does
not need to be exposed to user code.

This change adds documentation of the method with a deprecation
warning, and a test that the method is actually documented.

PR-RUL: #14223
Refs: #7619
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>

addaleax commented Aug 7, 2017

Copy link
Copy Markdown
Member

Shouldn’t this have been semver-major? I’m labelling as such but I’d like to point out that this should really have gotten another @nodejs/ctc approval according to our rules.

addaleax added the semver-major PRs that contain breaking changes and should be released in the next major version. label Aug 7, 2017

Copy link
Copy Markdown
Member

(@nodejs/release: This is semver-major and has no valid PR-URL: metadata, any idea how to work around this showing up in branch-diff until the end of time?)

gibfahn commented Aug 12, 2017

Copy link
Copy Markdown
Member

(@nodejs/release: This is semver-major and has no valid PR-URL: metadata, any idea how to work around this showing up in branch-diff until the end of time?)

I don't think there's a way at the moment, we have some of these for 6.x. Maybe teaching branch-diff to parse commit comments with valid metadata would be the way to go.

lance commented Aug 23, 2017
edited
Loading

Copy link
Copy Markdown
Member Author

@addaleax @gibfahn The PR-URL: metadata was a typo on my part (PR-RUL: #14223) in 766506a. My apologies for the error. WRT semver-major, if I had realized, I would have waited for a 3rd. Again, my mistake.

gibfahn pushed a commit that referenced this pull request Oct 30, 2017
This method does not need to be visible to user code. It has been
undocumented since it was introduced which was perhaps v0.8.9.

The motivation for this change is that the method is simply an
implementation detail of the REPLServer behavior, and does
not need to be exposed to user code.

This change adds documentation of the method with a deprecation
warning, and a test that the method is actually documented.

PR-RUL: #14223
Refs: #7619
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

repl Issues and PRs related to the REPL subsystem. semver-major PRs that contain breaking changes and should be released in the next major version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants


Back | FazBrowse Home | New Git URL