Determine if a value is Callable/Constructible

Yehuda Katz wycats at
Mon Mar 30 16:00:24 UTC 2015

On Mon, Mar 30, 2015 at 8:54 AM, Domenic Denicola <d at> wrote:

> From: Kevin Smith [mailto:zenparsing at]
> > I'd imagine that you'd re-spec [[Call]] for class constructors to
> basically do `this[](...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.

I like the idea of a special syntactic form a lot. One of the nice things
about `constructor` is that it's easy to explain "you [[Construct]] with
the constructor". We can't use `call` similarly any more, but I totally
agree something like it would be pretty nice.

On the flip side, it's not *entirely* clear that allowing people to
override [[Call]] on an existing function is a no-go. Changing the `typeof`
via installing a symbol definitely seems like bad juju though.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list