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

suggestion: re-consider the deprecation of read()/write() methods and std/io #21797

Closed
iuioiua opened this issue Jan 5, 2024 · 2 comments
Closed

Comments

@iuioiua
Copy link
Contributor

iuioiua commented Jan 5, 2024

The Deno.Reader interface and friends are deprecated in favour of the Streams API, pending removal in Deno v2 (see #21465). However, classes that implement these interfaces (e.g. Deno.FsFile and Deno.Conn) are supposed to be keeping their read() and other related methods (see #21701). There are pros and cons to either keeping or removing these methods.

Should we keep read(), write() and friends? These methods are fast, easy to use, and easy to understand. This is more than likely why devs use them. However, keeping these methods means we have two means of interacting with IO when there's also the Streams API. This incurs an engineering cost. Arguably, read(), write(), etc., are simple enough that their maintenance within the runtime is minimal. If so, we should reconsider the deprecation of std/io, as the sub-module validly justifies staying around.

Or should we remove read(), write() and friends? This would likely cut engineering costs and focus efforts on making the Streams API faster and easier to use. There'd likely be some unhappy devs with the decision initially, but such engineering efforts over time may counteract that, especially from developing helpers in the Standard Library (i.e. std/streams). The drawback is that we lose a simple means of interacting with IO.

To be clear, I'm not strongly for or against doing either. I'd like to outline the pros and cons, including those related to std/io.

@bartlomieju
Copy link
Member

If you're discussing read() and write() methods on various classes then yes, we should keep them (otherwise it would be a huge breaking change and I know @dsherret especially would like to keep them). But it should only be these methods that are directly on the classes - we want to get rid of all the methods/API that accept a "resource id" (rid).

@iuioiua
Copy link
Contributor Author

iuioiua commented Jan 5, 2024

Ok. I realise read() and write() methods are here to stay. Closing in favour of denoland/std#4120.

@iuioiua iuioiua closed this as not planned Won't fix, can't repro, duplicate, stale Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants