- From: Boris Zbarsky <notifications@github.com>
- Date: Tue, 18 Apr 2017 10:03:18 -0700
- To: heycam/webidl <webidl@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <heycam/webidl/issues/345/294911678@github.com>
As I see it, we need the following bits here: 1. A way to indicate that a named thing is an array subclass, not a normal interface. I would vaguely prefer dedicated syntax here, to prevent the problems we have with mixins and their syntax. 2. Some decisions on what it means to do a JS-to-idl conversion for array subclasses. I suspect the answer is that there should be no such thing. That is, this would be the first type where there is some sort of meanigful idl-to-JS conversion but not a meaningful JS-to-idl conversion. I sometimes wonder whether we should have done this for FrozenArray too... In any case, the obvious way to use an Array subclass would be as a return value only, with sequence used as the corresponding argument type. What this means for writable attributes, unclear. 3. Operations and attributes defined on an array subclass would need a somewhat different processing model from existing interface members. In particular, it's not clear that they would be able to do the sort of brand checks that interface members do, nor that it would be desirable to do them even if they could. My gut feeling is that such operations/attributes should be written in a way that works generically for any Array or maybe even arraylike "this" value. 4. It's not clear to me whether we want to support some sort of additional internal slots on array subclasses. Not least because it's not clear to me how one would use them and how one would ensure they actually exist, etc. 5. As @domenic says, we would want to think about how operations on array subclasses handle incorrectly typed elements. We could leave it up to every operation, or we could have some default behavior somehow or a few predefined options... 6. We would want to think about how operations actually iterate over the array (length + indices, array iterator, something else?) and whether operations should define this themselves or whether we provide a default or a few predefined options. NodeList can't become an Array subclass. Between Elements and what CSS typed OM is doing I think we would have two consumers... -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/heycam/webidl/issues/345#issuecomment-294911678
Received on Tuesday, 18 April 2017 17:03:52 UTC