On Tue, Jul 16, 2013 at 7:10 PM, Erik Arvidsson <[email protected]>wrote:

> All of the new constructors, Map, Set, WeakMap and WeakSet should fail
> when called as a function unless `this` already has a certain internal
> property, ie [[MapData]]. This is so that sub classing works as
> expected.
>
> However, all JS engines that supports Map, Set and WeakMap are future
> hostile and they all return a new instance when called as a function.
> For example, here is the V8 code:
>
> function MapConstructor() {
>   if (%_IsConstructCall()) {
>     %MapInitialize(this);
>   } else {
>     return new $Map();
>   }
> }
>
> I understand that fully supporting @@create requires a lot of work but
> until then we should at least throw when called as function to allow
> us to get out of this mess eventually.
>

It's painful, but I agree. This will prevent a build up of incorrect code
that may hold @@create semantics hostage.

Rick
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to