Re: [whatwg/streams] Standard text for TransformStream (#811)

domenic approved this pull request.

Reviewed everything. Pretty happy.

I left one comment about comments being translated to notes, and I think it applies more generally. I'd be happy to add more notes to the algorithms in the same place you added comments in the .js file. I wish we'd done that with the other streams, but since we have that here, it'd be nice.

> +
+<h4 id="is-transform-stream" aoid="IsTransformStream" nothrow>IsTransformStream ( <var>x</var> )</h4>
+
+<emu-alg>
+  1. If Type(_x_) is not Object, return *false*.
+  1. If _x_ does not have a [[transformStreamController]] internal slot, return *false*.
+  1. Return *true*.
+</emu-alg>
+
+<h4 id="transform-stream-error" aoid="TransformStreamError" nothrow>TransformStreamError ( <var>stream</var>, <var>e</var> )</h4>
+
+<emu-alg>
+  1. Perform ! WritableStreamDefaultControllerErrorIfNeeded(_stream_.[[writable]].[[writableStreamController]], _e_).
+  1. If _stream_.[[readable]].[[state]] is `"readable"`, perform !
+     ReadableStreamDefaultControllerError(_stream_.[[readable]].[[readableStreamController]], _e_).
+  1. If _stream_.[[backpressure]] is *true*, perform ! TransformStreamSetBackpressure(_stream_, *false*).

This has a comment in the source that seems like it might be useful to include in the standard as a note. However it references things I'm not sure about, like write()/pull()/enqueue(). Are those on the transform stream source/sink? Maybe it can be rephrased to capture the important points without the details; not sure.

> +</emu-alg>
+
+<h5 id="ts-default-source-pull" method for="TransformStreamDefaultSource">pull()</h5>
+
+<emu-alg>
+  1. Let _stream_ be *this*.[[ownerTransformStream]].
+  1. Assert: _stream_.[[backpressure]] is *true*.
+  1. Assert: _stream_.[[backpressureChangePromise]] is not *undefined*.
+  1. Perform ! TransformStreamSetBackpressure(_stream_, *false*).
+  1. Return _stream_.[[backpressureChangePromise]].
+</emu-alg>
+
+<h5 id="ts-default-source-cancel" method for="TransformStreamDefaultSource">cancel(<var>reason</var>)</h5>
+
+<emu-alg>
+  1. Perform ! TransformStreamError(*this*.[[ownerTransformStream]], _reason_).

Just noticing this... is this correct behavior? I'd have thought it'd be more like terminate than error.

-- 
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/811#pullrequestreview-70956183

Received on Friday, 20 October 2017 20:42:54 UTC