Re: [whatwg/streams] light weight transformations (#461)

> reading the spec, I see pipeThrough
but I don't understand what you mean by "not reifying" the stream.

I meant that pipeThrough would say "oh, this is a sync map transform stream; let me just run synchronous mapping as an unobservable optimization, instead of using the readable and writable ends and their queues." If you never call the `ts.readable` getter, no ReadableStream would necessarily even exist.

> I'm not sure whether you where implying TransformStream.map in the functional sense of "map",
but there is definite need for a transform to be able to expand and contract the input.

Yes, that's what I meant. If you want to expand and contract the output, you use the normal TransformStream constructor, as in [this test](https://github.com/whatwg/streams/blob/da4229eb1f9a87ef4986ffbde3da07ee024eca53/reference-implementation/test/transform-stream.js#L87-L93)

> Is the syncMap function passed a chunk? I'm talking about something that is passed the preceding readable.

Right, that was what I was thinking.

A function that is passed a readable seems like something you can already do in JavaScript, with no need for additional work from the streams spec...



---
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/461#issuecomment-223148610

Received on Wednesday, 1 June 2016 22:53:28 UTC