Re: [streams] Requirement on promises equality (#266)

I would like you guys to take a look at [my attempt at fixing this for `.ready`](https://github.com/whatwg/streams/commit/d878de69243a3d8284d6239b82de4ed68f02851f). If it looks good I will do so for  `ExclusiveStreamReader` as well.

(An interesting point to note is that I tested by commenting out each "cache invalidation" and every one causes at least some tests to fail or hang. So that's good!)

I experimented for a couple hours with approaches that didn't add another internal slot. For example, moving the `.then(() => this.ready)` logic to resolution-time. But eventually I realized that was impossible, because readers need to be able to update the "true" promise while the public API cannot return that, so there needs to be at least two.

Although this is more code, I think that this approach is strictly more efficient (in that strictly fewer objects are created). Even if we moved everything to methods that return fresh objects every time, that would be worse for authors with regard to efficiency.

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/266#issuecomment-72764925

Received on Wednesday, 4 February 2015 00:13:09 UTC