Intercepting sets on array-like objects
d at domenic.me
Fri Jun 9 21:07:09 UTC 2017
I'm not really sure how you're expecting to get an answer "according to TC39." One member had replied and given his suggestion. I don't think it's a good one for new APIs; I think new APIs should use arrays and not type check on sets but at processing time. I'm sure there will be many other opinions from other TC39 members.
From: "Tab Atkins Jr." <jackalmage at gmail.com>
Sent: Jun 9, 2017 5:02 PM
To: Adam Klein
Subject: Re: Intercepting sets on array-like objects
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. ^_^
es-discuss mailing list
es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss