SpeciesConstructor(o, %Set) vs. %Set%

Kevin Gibbons kevin at shapesecurity.com
Fri Dec 14 02:40:56 UTC 2018


That is an excellent question; see
https://github.com/tc39/ecma262/issues/1313 . I would lean towards using
SpeciesConstructor because it is consistent with the language as currently
defined, and we have not gotten consensus to decide on a different design.

It's pretty unfortunate because it seems likely that very few people will
ever benefit from subclassing Set but every visitor of every webpage which
uses one of these methods during first load will have to pay the price of
several observable property lookups, but what can you do. That's already
true for anyone using `.map` on an array or `.then` on a promise.



On Thu, Dec 13, 2018 at 1:13 PM Jordan Harband <ljharb at gmail.com> wrote:

> My sense is that any time you want to enable subclassing, you'd use
> SpeciesConstructor - are there specific cases where you're seeing it not be
> used?
>
> On Thu, Dec 13, 2018 at 12:06 PM Michał Wadas <michalwadas at gmail.com>
> wrote:
>
>> Hi.
>>
>> This is question directed more to TC39 members. I'm updating Set methods
>> proposal right now and I don't understand when SpeciesConstructor should be
>> used and when I should just hardcode %Set%.
>>
>> Michał Wadas
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20181213/44a7dea3/attachment-0001.html>


More information about the es-discuss mailing list