Skip to content

doc: replace util.inherits() with es6 classes extends #6512

Description

@eljefedelrodeodeljefe

util.inherits() is probably long unloved. With full class support it would be worth thinking of slowly deprecating it as weakly suggested in #4179 by @bnoordhuis .

Since this would strongly promote the class keyword for the JS world we would need to think about whether we want to do this and in which form. Personally I am not a big fan of it in general - especially since es6 proposed style would have methods on a non 0 indentation level. So we could think about the following:

cc @nodejs/documentation @jasnell

constEventEmitter=require('events')classPureES6extendsEventEmitter{constructor(){super()}echo(val){console.log(val)}}letes6=newPureES6()es6.echo('A Value')classMixedextendsEventEmitter{constructor(){super()}_echo(val){console.log(val)}}Mixed.prototype.echo=functionecho(val){this._echo(val)}letmixed=newMixed()mixed.echo('A Value')

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to the documentations.utilIssues and PRs related to the built-in util module.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions