Re: [whatwg/streams] "Set totalSize to totalSize + pair.[[size]]." (#582)

@tschneidereit we haven't explicitly forbidden negative sizes (yet?). We could add a check every time we call the size function, but we don't have one right now. I think most of your pose assumes nonnegative sizes.

---

My personal conflict is that I lean toward "Any of these is fine." and then I look at the code and see that we have these two coupled variables, [[queue]] and [[queueTotalSize]], and we only reset one of them. That seems wrong. So that's why I introduced ResetQueue.

I think introducing something like ResetQueue is necessary since otherwise when you empty the queue you could still have a desiredSize of 5. No rounding errors involved, just enqueue 2, enqueue 3, error the stream. Queue is empty and desiredSize is 5. Not great. Maybe we could just claim that desiredSize is meaningless when the stream is closed or errored?

Or maybe we should ape writable streams and set it to null!! That actually sounds better. Let's do that.

With that resolution in mind, I think setting it to null on closed/errored and then just leaving it alone for empty is fine. That doesn't get us many expectations but "anything is fine" IMO :)

-- 
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/582#issuecomment-273827195

Received on Thursday, 19 January 2017 16:38:48 UTC