Re: [whatwg/streams] Warn about async processing of written/transformed chunks (PR #1239)

> 1. Does recommending that the underlying sink make a copy of the data help when the data could also have been modified between the call to `WritableStreamDefaultWriter.write()` and when `write()` is called on the underlying sink?

This is a great point. Such modifications do not break the run-to-completion nature of JavaScript, like reading "in parallel" would. But they do make the code harder to reason about. I was trying to subsume the sub-problem of "parallel modifications" into the larger issue of "async modifications", but I agree that the advice in this PR doesn't really solve the async modifications problem at all.

So, I think I will change the advice here. I will have producer-focused advice, to not reuse the buffer until the promise is settled (as you suggest). And then I will have spec-writer focused advice, to not use our special spec-writer/browser-engineer powers to perform parallel reads (and thus expose ourselves to parallel modifications).

Revision coming right up.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/1239#issuecomment-1236545634
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/streams/pull/1239/c1236545634@github.com>

Received on Monday, 5 September 2022 05:10:40 UTC