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

doc: discourage use of util.inherits; point to es6 extends #6514

Closed
wants to merge 6 commits into from
Closed

doc: discourage use of util.inherits; point to es6 extends #6514

wants to merge 6 commits into from

Conversation

eljefedelrodeodeljefe
Copy link
Contributor

@eljefedelrodeodeljefe eljefedelrodeodeljefe commented May 2, 2016

Checklist
  • tests and code linting passes
  • documentation is changed or added
  • the commit message follows commit guidelines
Affected core subsystem(s)

doc

Description of change

util.inherits breaks the prototype chain. A fix does not seem
useful, since ES6 extends provides language level support for the
same functionality.

This commit starts phase out mentions of the method.

Fixes: #4179, #6512

util.inherits breaks the prototype chain. A fix does not seem
useful, since ES6 extends provides language level support for the
same functionality.

This commit starts fasing out mentions of the method.

Fixes: #4179
@nodejs-github-bot nodejs-github-bot added the doc Issues and PRs related to the documentations. label May 2, 2016
});
myEmitter.emit('event');
```
uses the ES6 classes. It is however possible to use traditional Node.js style
Copy link
Member

Choose a reason for hiding this comment

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

'the ES6 classes'? I'd drop the reference to util.inherits() entirely, by the way.

@eljefedelrodeodeljefe
Copy link
Contributor Author

@mscdex see this issue for reference #4179

@eljefedelrodeodeljefe
Copy link
Contributor Author

@bnoordhuis addressed your feedback in 28332bb with a question. Dragging in @jasnell here with regards to #6512

var buf = Buffer.from(str, 'ascii');
this.push(buf);
}
};
Copy link
Member

Choose a reason for hiding this comment

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

Still a semicolon here. If there are more, I won't point them out but please fix them. :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Missed that one. I hope found them all now. Note to myself: add doc linting some time.

@mscdex mscdex added the util Issues and PRs related to the built-in util module. label May 2, 2016
@eljefedelrodeodeljefe
Copy link
Contributor Author

@bnoordhuis does your #6545 block this here? Otherwise LGTY @jasnell @targos @bnoordhuis ?

@bnoordhuis
Copy link
Member

LGTM at a quick glance, looks like you addressed all the comments.

@@ -126,6 +126,10 @@ util.format(1, 2, 3); // '1 2 3'

## util.inherits(constructor, superConstructor)

_Note: usage of util.inherits() is discouraged. Please use the ES6 `class` and
`extends` keywords to get language level inheritance support. Also note that
the two styles are semantically incompatible._
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this is the wrong place, but a link to explanation of semantically incompatible would be helpful if there is a good one, and we are ok with external links. Perhaps even just a link in the PR so it can be found by tracing back to this PR.

@eljefedelrodeodeljefe
Copy link
Contributor Author

@sam-github amended the link.

@jasnell
Copy link
Member

jasnell commented May 8, 2016

LGTM

@eljefedelrodeodeljefe
Copy link
Contributor Author

@sam-github LGTY?

@targos
Copy link
Member

targos commented May 9, 2016

LGTM

@eljefedelrodeodeljefe
Copy link
Contributor Author

@nodejs/collaborators we are discouraging the use of util.inherits() in docs now. Landed in 07c572d.

@addaleax
Copy link
Member

addaleax commented May 9, 2016

@eljefedelrodeodeljefe

$ core-validate-commit 07c572d85cd90b014de7a3e83349bcaeb1760f5a

  07c572d85cd90b014de7a3e83349bcaeb1760f5a
  ✖  4:50     Title must be <= 50 columns.              ETITLETOOLONG
     doc: discourage use of util.inherits; point to es6 extends
  ✖  15:0     PR-URL should be first line of metadata.  EMETAORDER
  ✖  16:0     PR-URL should be first line of metadata.  EMETAORDER
  ✖  17:0     PR-URL should be first line of metadata.  EMETAORDER
  ✖  0:0      Commit must have a PR-URL.                EMISSINGPRURL

If you can force-push fast, go for it. :)

eljefedelrodeodeljefe added a commit that referenced this pull request May 9, 2016
util.inherits breaks the prototype chain. A fix does not seem
useful, since ES6 extends provides language level support for the
same functionality.

This commit starts fasing out mentions of the method.

Fixes: #6512
Fixes: #4179

PR-URL: #6514
Reviewed-By: James Snell <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
@eljefedelrodeodeljefe
Copy link
Contributor Author

9daf4a2 then

evanlucas pushed a commit that referenced this pull request May 17, 2016
util.inherits breaks the prototype chain. A fix does not seem
useful, since ES6 extends provides language level support for the
same functionality.

This commit starts fasing out mentions of the method.

Fixes: #6512
Fixes: #4179

PR-URL: #6514
Reviewed-By: James Snell <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
@MylesBorins
Copy link
Contributor

@eljefedelrodeodeljefe This does not land cleanly in LTS. Added dont-land label. Please feel free to manually backport

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. util Issues and PRs related to the built-in util module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

util.inherits does not establish prototype chain
10 participants