Intercepting sets on array-like objects
Tab Atkins Jr.
jackalmage at gmail.com
Fri Jun 9 21:01:36 UTC 2017
On Fri, Jun 9, 2017 at 1:57 PM, Adam Klein <adamk at chromium.org> wrote:
> On Thu, Jun 8, 2017 at 11:32 AM, Tab Atkins Jr. <jackalmage at gmail.com>
>> Note that if we don't get some variant of this functionality, these
>> APIs will instead do one of:
>> * just using Proxies (already defined in WebIDL)
> When you say "Proxies" here, I believe you're referring to the "indexed
> properties" feature of WebIDL
> (https://heycam.github.io/webidl/#idl-indexed-properties). This seems like
> the right mechanism to use, from a WebIDL spec, to get the behavior you
> desire. In Chromium/V8, this doesn't actually use Proxies under the hood (we
> have something called "indexed property handlers", see the API at
> but it's definitely implementable using Proxies.
WebIDL's indexed getters/setters would fulfill my use-case *exactly*.
If that's okay to use, per TC39 consensus, then awesome!
However, in <https://github.com/heycam/webidl/issues/345#issuecomment-300734048>
> [When] we discussed those kind of approaches with TC39, they told us not
> to and to just use Array. It wasn't just about , it was also about FileList,
> NodeList, etc. And the problem with those was not that they did not have
> enough methods like Array, it was that they required a proxy.
Thus my confusion/consternation.
If this is incorrect, and indexed getters/setters are indeed fine to
use in new APIs, then we can close this thread "no change" and I can
go away happy. ^_^
More information about the es-discuss