Re: [whatwg/streams] Review request on the ReadableStream API (#433)

I just stumbled on this Stream spec thing and I'm confused.

Why isn't a byte stream the lowest level building block here? Now it seems "ReadableStream" and "ReadableByteStream" are at the same level of abstraction, even though everything that might go through a stream consists of bytes.

In other words, "byte streams" are actually a lower-level thing than "<foo> streams". For example, a TCP connection is a _two-way_ byte stream.

Does this tech involve Node somehow? I hope this is pure web tech. Or at least that's what the world needs - not some sort of hybrid that carries Node's baggage like basically everything in the front-end world these days.

Note also that a "push source" is basically the same thing as an Observable, which itself is conceptually a Stream. 

In fact, isn't a "pull source" a Stream too? Pushing and Pulling are just different ways of arranging for stuff to come out of a Stream! 

So basically a ReadableStream contains a Stream-that's-not-called-a-Stream? Why wouldn't a ReadableStream just wrap an inner ReadableStream? Streams all the way through. That's the way Java has done it for ages.

I also noticed people talking about reading stuff from a stream, and it looked like you should have just copied what Java does, or come up with something better (if possible). 

Check this out: https://docs.oracle.com/javase/7/docs/api/java/io/InputStream.html#read(byte[],%20int,%20int) - it works. It's worked for _ages_.

This reminds me, why would a GzipStream be a "TransformerStream", with both a Readable- and a WriteableStream? Why would it be necessary?

See what they've done with Java again: https://docs.oracle.com/javase/7/docs/api/java/util/zip/GZIPInputStream.html - it reads bytes from a wrapped InputStream, and something uses it to read gzipped bytes.

Maybe I'm completely missing something here, but I get the feeling that this spec has gone in the wrong direction.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/433#issuecomment-266025062

Received on Friday, 9 December 2016 14:24:23 UTC