Determine if a value is Callable/Constructible

Domenic Denicola d at domenic.me
Mon Mar 30 15:54:25 UTC 2015


From: Kevin Smith [mailto:zenparsing at gmail.com] 

> I'd imagine that you'd re-spec [[Call]] for class constructors to basically do `this[Symbol.call](...args)` instead of just throw.  It would therefore only have an effect within class constructors.  Is that still weird?

At least it's explicable, but it's still pretty weird I think. I mean, we don't specify [[Construct]] by saying that it does `new this.prototype.constructor(...args)` or similar. The asymmetry is jarring.

And it's weird to have this symbol with such a generic name that doesn't work for anything except class syntax. I'd expect symbols to be for re-usable protocols... that's fuzzy intuition though, I admit, and might be contradicted by existing examples.



More information about the es-discuss mailing list