Re: [heycam/webidl] Remove [LegacyArrayClass] (#291)

`a[0]` will work just fine for things with indexed getters, right?

`forEach` will work for anything with an iterable declaration, including a thing with an indexed getter and a value iterable decl.

But yes, the lack of `map()` is just kinda silly.  On the other hand, the lack of `reverse()` is not necessarily silly...

Anyway, without having seen your use cases, it seems like generally we have a few options:

1. Just accept that we have some [ArrayClass] things.  That requires an indexed getter and an optional indexed setter if you want the mutation functions to work.  The latter might require a writable "length" too.
2. Explicitly give more things the `forEach` treatment.  The list of plausible candidates here probably includes all the non-mutating functions on Array.prototype: `includes`, `indexOf`, `lastIndexOf`, `find`, `filter` (but what sort of object should this return?), `map` (again, what should this return?), `reduce`, `reduceRight`, `some`.  We already have `forEach`, `keys`, `values`, `@@iterator`.  This all still involves indexed props.
3. Do actual Array subclasses.  This has the drawback of it probably being a bit more pain to write specs in terms of these, and it not being clear to me what the readonly story is, if anything.  It has the benefit that all the stuff on Array will work.

maplike/setlike were a much easier problem, because Map/Set they only admit mutation via methods, so doing a readonly thing is easy: just leave out those methods....

-- 
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/291#issuecomment-283473310

Received on Wednesday, 1 March 2017 21:18:57 UTC