Erik Arvidsson (2013-07-16T23:10:53.000Z)
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.

--
erik
domenic at domenicdenicola.com (2013-07-18T16:29:51.524Z)
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:

```js
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.