Determine if a value is Callable/Constructible

Domenic Denicola d at
Mon Mar 30 15:09:59 UTC 2015

I don’t think [] is a very good mechanism. A new syntactic form would make more sense.

It doesn’t seem right that you should have to introduce an observable prototype property just to get [[Call]] behavior. (Or a constructor property, if you change the syntax to `static []() { … }`.)

And it raises the question of what happens when I add a [] property to other objects. What does it even mean? If I do `var obj = { prototype: { []() { console.log("foo"); } } }`, can I now call `obj()`? Is `typeof obj === "function"`? Very strange stuff. Presumably not very VM-friendly either, but that's just a guess.

More information about the es-discuss mailing list