Skip to content

Vote on the approach for https://github.com/nodejs/node/issues/445 #355

@mcollina

Description

@mcollina

In nodejs/node#445, the streams WG was tasked to remove the access of _writableState and _readableState across the various areas of core.

Three approaches are possible:

a. leave _writableState and _readableState as is, and just document them. A variation is to remap them without the _, but keep them in the same object. This would cause to expose a lot of other properties we do not need.

b. expose the part of the state as properties/getters on the stream object themselves, with the disadvantage that the streams would get some more properties.

c. allocate a new object for writableState and readableState and use getters there to link them to the _writableState and _readableState. This would force the creation of 2 more objects for each Duplex, and the allocation of a stream is already slow. Plus, it creates more references to clean up by the GC.

For the Streams WG, the best choice is option b), followed by option a) (do nothing).

In nodejs/node#445 and nodejs/node#12857 @mscdex expressed a formal -1 on the approach, preferring option c).

We should vote on the following:

  1. Can we add readableLength and writableLength to Readable and Writable respectively stream: remove {writeableState/readableState}.length node#12857?
  2. Can we add other properties like the above to Readable and Writable do remove the need to access _readableState and _writableState Cleanup _writableState and _readableState access across codebase node#445?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions