Re: [whatwg/streams] Factor out readyPromiseIsPending calculation (#671)

domenic requested changes on this pull request.



> @@ -2683,6 +2683,7 @@ WritableStream(<var>underlyingSink</var> = {}, { <var>size</var>, <var>highWater
      potential types in the future, without backward-compatibility concerns.</p>
   1. Set *this*.[[writableStreamController]] to ? Construct(`<a idl>WritableStreamDefaultController</a>`, « *this*,
      _underlyingSink_, _size_, _highWaterMark_ »).
+  1. Return ? WritableStreamDefaultControllerStart(*this*.[[writableStreamController]]).

Why factor this out? It doesn't seem to meet the criteria in https://github.com/whatwg/streams/blob/master/Contributing.md#spec-editorial-conventions

> @@ -2932,6 +2924,15 @@ nothrow>WritableStreamFinishPendingCloseWithError ( <var>stream</var>, <var>reas
   1. Perform ! WritableStreamRejectClosedPromiseIfAny(_stream_).
 </emu-alg>
 
+<h4 id="writable-stream-is-ready-promise-pending" aoid="WritableStreamIsReadyPromisePending"
+nothrow>WritableStreamIsReadyPromisePending ( <var>stream</var>, <var>state</var>, <var>wasAborted</var> )</h4>

I guess this is a preexisting problem, but I am not sure this is the best name. I would expect "ReadyPromiseIsPending" to just return whether stream.[[writer]].[[readyPromise]].[[PromiseState]] is "pending". This instead does a complex calculation on the states and the backpressure. What is the actual thing we are trying to capture here? Maybe "WritableStreamIsReadyForWrites"?

> @@ -2932,6 +2924,15 @@ nothrow>WritableStreamFinishPendingCloseWithError ( <var>stream</var>, <var>reas
   1. Perform ! WritableStreamRejectClosedPromiseIfAny(_stream_).
 </emu-alg>
 
+<h4 id="writable-stream-is-ready-promise-pending" aoid="WritableStreamIsReadyPromisePending"
+nothrow>WritableStreamIsReadyPromisePending ( <var>stream</var>, <var>state</var>, <var>wasAborted</var> )</h4>
+
+<emu-alg>

I really don't like passing in state and wasAborted. Can we get those from the stream instead? It seems they are almost always computed the same way, so that would just be more good deduplication.

-- 
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/pull/671#pullrequestreview-18485619

Received on Wednesday, 25 January 2017 19:50:10 UTC