Re: [whatwg/streams] ReadableStreamDefaultController seems redundant (#743)

So, to make my feedback more concise:

It seems to me that if there were a function which constructs an RS/WS pipe pair, it could be used in all the same use cases where people would use the RS or WS constructors today. Given this, it seems to me that removing the constructors and instead providing a simple function to create a pipe pair would make the standard a lot easier to understand and to implement. Currently, I feel that the constructors are over-engineered.

It looks like @domenic addresses this head-on here: https://github.com/whatwg/streams/issues/102#issuecomment-40528306

My understanding of his argument is that he's saying: "How does the make-pipe function construct the two objects that it returns? If they don't have constructors, then we're cheating, using 'C++ browser magic' to connect objects in a way that couldn't possibly be done in pure JS."

I don't buy this. I think it's reasonable to say: "The constructors are private implementation details." Or, better yet: "The objects returned are private subclasses of ReadableStream and WritableStream which override all of the methods." This is pretty standard OOP practice, so I don't see why you'd want to avoid it.

I feel like there's some design goal here that I don't understand, though, where the concept of an "abstract interface which cannot be instantiated directly" is considered inherently undesirable?

-- 
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/743#issuecomment-306067074

Received on Sunday, 4 June 2017 21:08:59 UTC