- From: Domenic Denicola <notifications@github.com>
- Date: Mon, 08 Dec 2014 17:43:49 -0800
- To: whatwg/streams <streams@noreply.github.com>
- Message-ID: <whatwg/streams/issues/241/66221645@github.com>
Heh, thanks. I've been working through this all day actually. Last week was spent on some V8 work, sorry. Here is some stuff I wrote up: https://github.com/whatwg/streams/blob/lock/reference-implementation/lib/experimental/locking.md Currently I am trying to work out all the implications of exactly how to specify this. I think the work at https://github.com/whatwg/streams/blob/lock/reference-implementation/lib/experimental/exclusive-stream-reader.js is pretty OK, although there are a few issues: - I want to make sure it is optimizable. As-is, the try/catch surrounding all the delegating methods/getters of the reader is overhead. Implementations should ideally be able to optimize, at least in the non-subclass case. I want to outline a strategy for doing so, even if that isn't spec-level material. It will probably look similar to your idea of a stream having a default reader. (However, as explained in the linked doc, that isn't very friendly to subclasses: for subclassing to work seamlessly, StreamReader should delegate to ReadableStream, instead of ReadableStream delegating to StreamReader.) - If we say that custom readable stream implementations must do their own locking mechanism without our help, then we can simplify it a bit (remove getToken/setToken, and probably that means we can do `new StreamReader(stream)` instead of `stream.getExclusiveReader()`). I think I am OK with that since custom implementations already have to do so much work, and subclassing will give you most of the benefits. (See the linked writeup for more details on the differences here.) - Need to nail down some naming - Need to figure out how to do the right semantics for `ready` and `state`. Anyway this will be my focus for the next day or two; it's getting to be end of day here so tomorrow is likely when most of the work will be done. I aim to have a pull request up for discussion by EOD tomorrow. --- Reply to this email directly or view it on GitHub: https://github.com/whatwg/streams/issues/241#issuecomment-66221645
Received on Tuesday, 9 December 2014 01:44:16 UTC