Skip to content

Stream.Writable has no need to inherit from Stream #2961

@ronkorving

Description

@ronkorving

Writable currently inherits from Stream without any visible benefit. Stream only exposes pipe() which Writable's own prototype replaces. Would it not be beneficial to make Writable inherit straight from EventEmitter? That way, all EE related API would not need to go one level deeper into the prototype chain, and its constructor would speed up a bit.

I'm asking for feedback, because I'm not sure about drawbacks, or how Duplex may ruin this idea. The only thing that this will break is myWritable instanceof Stream tests. That is BC breakage, but the effects should be very limited I imagine. Also, it doesn't seem to happen anywhere in Node itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    semver-majorPRs that contain breaking changes and should be released in the next major version.streamIssues and PRs related to the stream subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions