You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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, the streams WG was tasked to remove the access of
_writableStateand_readableStateacross 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:
_writableStateand_readableStateaccess across codebase node#445?