-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
It's nice to be able to treat functions like Set.from
as actual functions which can be passed around, so that you can do stuff like let sets = [ [0, 1], [2, 3] ].map(Set.from)
. As currently spec'd this does not work because of the If IsConstructor(C) is false, throw a TypeError exception.
step.
I think it would make sense to match the behavior of Array.from
, which has the behavior of using the realm-default constructor for Array
when the this
value is not constructible. That way you get the subclassing behavior (where class MyMap extends Map {}; MyMap.of() instanceof MyMap /* true */;
) while still allowing the functional-style invocation above.
michaelficarra, ljharb, ExE-Boss and bathos
Metadata
Metadata
Assignees
Labels
No labels