>On Mar 30, 2015, at 1:44 PM, Domenic Denicola <[email protected]> wrote:
>>From: Axel Rauschmayer [mailto:[email protected]]
>>As in “makes sense to call”. In the past, `typeof x === 'function'” was an
>>adequate test for checking whether it makes sense to call `x`.
>
I> tried to explain explicitly why I don't think this is true.
>
>>Since ES6, it isn’t, anymore.
>
>I disagree. The situation has not changed at all.
As I said above:
```js
var called = false;
function F() {
called = true;
throw new TypeError(“can’t call F()”);
}
F(); // Throws, but `called` is true
called = false;
class C {
constructor() {
called = true;
throw new TypeError(“can’t call C()”);
}
}
C(); // Throws, but `called` is false, because the constructor was never invoked
```
That distinction means that you can’t “really” [[Call]] a constructor, it’s
just that the reason is slightly different from trying to [[Call]] an Array
instance (or something)
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss