Determine if a value is Callable/Constructible

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


Great to get the ball rolling. Here's some issues I'd bring up at the meeting, so we can get a head start:

- As discussed recently in https://esdiscuss.org/topic/reflect-getownpropertysymbols, right now Reflect only holds counterparts to the proxy traps. I think this is kind of a nice property. Do we want to expand Reflect into a dumping ground for all "reflective" operations? That's been implied many times on the list, but so far hasn't happened, from what I can see. On the other hand, I don't have any good ideas for where else to put these things. (Maybe Function.isConstructor? Not sure it scales.)

- Reflect.isCallable seems pretty pointless, when you can just do `typeof x === "function"`. YAGNI IMO. Note that it also doesn't match your earlier description from https://esdiscuss.org/topic/determine-if-a-value-is-callable-constructible#content-0, so it presumably doesn't solve those use cases. (But that definition can't really be workable, since all of the things you mention as not being callable are actually callable, in the same way `function f() { throw new TypeError(); }` is callable.)



More information about the es-discuss mailing list