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

Stream writable/readable properties are undocumented as of streams2 #21431

Closed
strugee opened this issue Jun 20, 2018 · 19 comments
Closed

Stream writable/readable properties are undocumented as of streams2 #21431

strugee opened this issue Jun 20, 2018 · 19 comments
Labels
doc Issues and PRs related to the documentations. stream Issues and PRs related to the stream subsystem.

Comments

@strugee
Copy link
Contributor

strugee commented Jun 20, 2018

  • Version: 10
  • Platform: N/A
  • Subsystem: doc

stream.Writable#writable is no longer documented, but according to https://stackoverflow.com/a/23094413/1198896 it exists and probably should be documented. Presumably the same is true for stream.Readable#readable?

@ChALkeR ChALkeR added doc Issues and PRs related to the documentations. stream Issues and PRs related to the stream subsystem. labels Jun 21, 2018
@killagu
Copy link
Contributor

killagu commented Jun 21, 2018

+1

@thatshailesh
Copy link
Contributor

https://nodejs.org/docs/v0.9.4/api/stream.html#stream_class_stream_writable
It was there before @Trott would like to know why it was removed? can we add again?

@Trott
Copy link
Member

Trott commented Jun 23, 2018

@nodejs/streams

@mcollina
Copy link
Member

I think these should be documented. They are used in the wild.

@strugee would you like to send a PR?

@thatshailesh
Copy link
Contributor

I am also willing to help with PR
@strugee let me know if you're not sending :)

@strugee
Copy link
Contributor Author

strugee commented Jul 2, 2018

Hey, sorry for the delay! I looked into this briefly and realized I'd have to dig through the source to make sure I had the right implementation details, and I haven't had time to do that yet. @thatshailesh given the situation, if you want to take this then by all means go ahead! Otherwise I can do this when I find some time :)

@thatshailesh
Copy link
Contributor

Ok Sure, I'll send it thanks :)

@thatshailesh
Copy link
Contributor

thatshailesh commented Jul 7, 2018

@felixrabe
Copy link

@thatshailesh - no, you linked to the uppercase Readable and Writable classes, whereas this issue is about the lowercase readable and writable properties which are still (last I checked) undocumented.

@strugee
Copy link
Contributor Author

strugee commented Jul 9, 2018

@felixrabe is correct. What we are looking for is something like https://nodejs.org/docs/v0.8.0/api/stream.html#stream_stream_readable, but note that that's for 0.8 streams and not streams2, which is why I said I'd have to dig into the implementation to make sure I wrote something correct.

@mcollina
Copy link
Member

mcollina commented Jul 9, 2018

Those properties are sill there, and I suspect they still work as before. I think they are still there for compatibility reason. You might want to add unit tests for them if there are none.

@ronkorving
Copy link
Contributor

So, I just wrote an issue and closed it as a duplicate. It is however not exactly a duplicate, but probably worth covering in the same breath as this issue.

net.Socket has a writable property. It does not initialize it in its constructor, so it depends on the Writable for it, which sets it to true in its constructor. After a successful connection, net.Socket sets it to true, which seems rather pointless since it was already true from construction time. Maybe this code is acceptable, if we decide that Writable owns it, and Writable stream implementations are always responsible for keeping that value correct.

@mcollina
Copy link
Member

@ronkorving I think Readable and Writable should be responsibile to set and maintain those values. Would you like to send a PR in that regard?

@ronkorving
Copy link
Contributor

@mcollina Can they though? net.Socket sets writable to true the moment connect() is called on it. I don't think there's a Writable hook there that could be depended upon to set that boolean instead. Got any suggestions?

@mcollina
Copy link
Member

mcollina commented Aug 1, 2018 via email

@ronkorving
Copy link
Contributor

@mcollina So then you're suggesting we move the entire property to net.Socket, right? Rather than Readable and Writable as I think you were suggesting in your previous comment? I don't mind if you guys pick it up of course 👍

@mcollina
Copy link
Member

mcollina commented Aug 6, 2018

We are a bit strained atm, so if you want to send a PR it would be very welcomed.

IMHO we should have those in stream.Readable and stream.Writable and document them. However, net.Socket could flip the value on startup if we want to be backward compatible. Given that the change would likely be semver-major anyway, I'm actually thinking that we should only have those properties in Readable  and Writable, and they should start both as true (because .read() and .write() will not error right after creation).

@ronkorving
Copy link
Contributor

@mcollina I fully agree with that approach. I may make a PR, but am a bit strained myself.

@antsmartian
Copy link
Contributor

This is fixed in : #23933. Hence closing it. Please re-open if I'm incorrect.

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. stream Issues and PRs related to the stream subsystem.
Projects
None yet
Development

No branches or pull requests

9 participants