Repository navigation
Closed
Labels
breaking changea change or feature that breaks existing semanticsa change or feature that breaks existing semanticsfeatnew feature (which has been agreed to/accepted)new feature (which has been agreed to/accepted)public APIrelated to "Deno" namespace in JSrelated to "Deno" namespace in JS
Milestone
Description
I propose we remove the following APIs from the Deno namespace, and move them to std:
Types:
-
Deno.Reader -
Deno.Writer -
Deno.ReaderSync -
Deno.WriterSync -
Deno.Closer
Functions:
-
Deno.Buffer(chore: deprecate Deno.Buffer and read/write utils #9793) -
Deno.copy(chore(runtime): deprecateDeno.copy#11369) -
Deno.iter(chore: deprecate Deno.iter and Deno.iterSync #10025) -
Deno.iterSync(chore: deprecate Deno.iter and Deno.iterSync #10025) -
Deno.readAll(chore: deprecate Deno.Buffer and read/write utils #9793) -
Deno.readAllSync(chore: deprecate Deno.Buffer and read/write utils #9793) -
Deno.writeAll(chore: deprecate Deno.Buffer and read/write utils #9793) -
Deno.writeAllSync(chore: deprecate Deno.Buffer and read/write utils #9793)
Timeline
I suggest we mark all the APIs we want to remove with @deprecated, and add a deno lint diagnostic for when these APIs are used. In Deno 2.0 we can then remove these APIs.
Reasoning
Code which does not actually require native syscalls should not use Deno namespace APIs as this makes the code incompatible with browsers, even though there is no need for that to be the case. An example of this: https://deno.land/std@0.90.0/io/streams.ts. This uses Deno APIs, even though no native calls are preformed, making this code unusable in a web browser for no good reason.
Reacted by Satya Rohith, William Perron, Luke Channings, Aaron Huggins, Axetroy, Nyakku Shigure, Mark Tiedemann, Garnet, Nadeem Ramsing, ljmsu and 28 more
Reacted by Dj, Erick Sosa Garcia, MierenManz and QuantumGhost
Reacted by josephrocca, Flavio Vilante, Daniel Beeke and Ivan Trofimov
Reacted by Jayden Seric, Alejandro Solano, Avindra Goolcharan and Liumingxun
Metadata
Metadata
Assignees
Labels
breaking changea change or feature that breaks existing semanticsa change or feature that breaks existing semanticsfeatnew feature (which has been agreed to/accepted)new feature (which has been agreed to/accepted)public APIrelated to "Deno" namespace in JSrelated to "Deno" namespace in JS
Activity
kitsonk commentedon Mar 15, 2021
Why move the types? They are referred to by other built ins that are returned, are they not?
kitsonk commentedon Mar 15, 2021
Buffer is also mentioned in #9588, we should maybe close that?
lucacasonato commentedon Mar 15, 2021
Same reason as to move the functions. Code using
Reader/Writeretc does not work whenlibisdominstead ofdeno.ns. IMO if it doesnt need to be a binding (or a type for those bindings) because it can work just fine in the browser, it should not be part of theDenonamespace.The builtins never explicitly return or take a reader/writer after these changes as far as i'm aware. They only return types that implement
ReaderorWriter. Instead of usingimplementin the d.ts, we can just specify theread/writemethods no the interfaces directly. This would make them implicitly implementReader/Writer(just like interfaces work in Go).timreichen commentedon Apr 26, 2021
@lucacasonato in addition to that: would you be open to rename
Deno.iter->Deno.iteratorDeno.iterSync->Deno.iteratorSyncfor aligning with the js name like in
Symbol.iterator?lucacasonato commentedon Apr 26, 2021
No. They are both in the process of being deprecated and will be removed. No reason to rename.
ry commentedon Jul 5, 2021
I'm in agreement. It's very painful to let web streams (ReadableStream/WritableStream) win over go streams (Reader/Writer). Go streams is plainly more general and vastly simpler. But we must have web streams because of fetch. And having two different and incompatible stream abstractions is worse than having one shitty one.
One of the original intentions of Deno was to correct the abysmal streams implementation in Node. I think Go provides a very elegant and complete solution with a beautiful library of combinations.
MierenManz commentedon Jul 5, 2021
We just have to hope that there will be a webstream2 at some point in the future that is based on go streams :/
nayeemrmn commentedon Jul 6, 2021
Just to clarify, this issue was about a purely symbolic refactor to remove the explicit type definitions of
ReaderandWriterin favour of just defining theread()andwrite()methods on their implementers. This is logical because there are no stable built-ins that accept these interfaces, only ones that return them. A one sided protocol so to speak. Since they do have consumers in std, it would be more appropriate to have the definitions there.Why @ry mentions above is the result of more recent discussion to remove even the concrete
read()andwrite()methods in favour of web stream APIs. We should continue in #11018 for that.kt3k commentedon Dec 22, 2022
We're removing the usages of
Deno.Reader,Deno.Writer, ... from std in denoland/std#3030iuioiua commentedon Aug 25, 2023
Perhaps, 2.0 is a good time to deprecate these interfaces. A counterargument is fast streams implementations are still in progress, and I wouldn't expect people to be happy with the deprecation unless the performance of the alternative was on par or better.
kt3k commentedon Aug 25, 2023
What to do about
Deno.SeekerandDeno.SeekerSync?kt3k commentedon Sep 13, 2023
There seem a few concerning points to this move:
seek()methodkt3k commentedon Sep 14, 2023
sync behavior might be implemented as
FileSystemSyncAccessHandlein the futureseekis available inFileSystemWritableFileStream, but I couldn't find a way to seek during reading in Web APIsiuioiua commentedon Dec 28, 2023
Update:
std/logno longer depends onDeno.Writer. See: denoland/std#4021iuioiua commentedon Jan 29, 2024
What do we think about this? Best to come to a decision before Deno v2. Related:
Deno.seek()andDeno.seekSync()were deprecated in Deno 1.40.bartlomieju commentedon Aug 31, 2024
All of these APIs are no longer available as of #25213 and Deno
2.0.0-rc.0.iuioiua commentedon Sep 10, 2024
We'll be also moving
Deno.Seeker[Sync]into@std/io/typesof the Standard Library.