SpeciesConstructor(o, %Set) vs. %Set%
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
> On Thu, Dec 13, 2018 at 12:06 PM Michał Wadas <michalwadas at gmail.com>
>> 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
> es-discuss mailing list
> es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss