- From: Mattias Buelens <notifications@github.com>
- Date: Sat, 26 Jul 2025 13:44:09 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Saturday, 26 July 2025 20:44:13 UTC
MattiasBuelens left a comment (whatwg/streams#1348) We transfer for safety reasons. Because `read(view)` is asynchronous and the underlying byte source may be filling the buffer incrementally in some implementation-specific fashion, we don't want to expose details about this process to the calling JavaScript code by having it "peek" at the backing buffer while it's being filled. We may want to loosen this restriction when dealing with a `SharedArrayBuffer`. That would allow a `WebAssembly.Memory` with `{ shared: true }` to work. See #757 for more discussion on this. We haven't made much progress on this front yet, so any extra insights are welcome! 🙂 > If `TypedArray.set` can "do" it, why can't `read`? Because `TypedArray.set` is fully synchronous. There is no way for JavaScript to observe a partially completed copy, because the JavaScript execution only resumes after the `set()` call. Granted though, this is no longer the case when the `TypedArray` is backed by a `SharedArrayBuffer`, in which case a second thread *could* observe the bytes being written incrementally. -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/streams/issues/1348#issuecomment-3123367810 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/streams/issues/1348/3123367810@github.com>
Received on Saturday, 26 July 2025 20:44:13 UTC