- From: Tab Atkins Jr. <notifications@github.com>
- Date: Wed, 01 Mar 2017 13:48:29 -0800
- To: heycam/webidl <webidl@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <heycam/webidl/issues/291/283481422@github.com>
> `a[0]` will work just fine for things with indexed getters, right? It "works fine" by requiring a proxy to intercept all numeric property accesses, because TC39 hasn't gotten its head out of its ass and added a hook for [] syntax yet. :( As such, it's not a solution we want to use in general. > But yes, the lack of map() is just kinda silly. On the other hand, the lack of reverse() is not necessarily silly... My use-case is dead lists, so there's nothing wrong with .reverse() or any of the other this-mutating functions. But yeah, if we wanted to do this "properly", you'd want to separate out the list of mutating functions. > filter (but what sort of object should this return?), map (again, what should this return?), Easy to define that the auto-defined versions of these methods return values of the same type, but I guess the problem is live collections, where it's not clear what the effect of such a thing would be? I bet we could hinge it on whether there exists a constructor that takes a single `sequence<>` argument: if so, those methods automatically cast the result back into the type; if not, you get an Array back. If you want an Array all the time, you can cast it yourself. Or make it more explicit, with a variant `iterator` declaration that says whether the collection is live or dead. (Maybe `arraylike<>` for the dead version?) And then require that `arraylike<>`s have an appropriate constructor to be valid. -- 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-283481422
Received on Wednesday, 1 March 2017 21:50:02 UTC