Well just to get the ball rolling, I’ve put together a markdown doc for this https://github.com/caitp/TC39-Proposals/blob/master/tc39-reflect-isconstructor-iscallable.md <https://github.com/caitp/TC39-Proposals/blob/master/tc39-reflect-isconstructor-iscallable.md>
It’s such a minor item that I’m not sure how much to add to it, so maybe someone else will have a go at it instead. (sorry for the spam) > On Mar 29, 2015, at 11:32 PM, Brendan Eich <[email protected]> wrote: > > Last thread: > https://esdiscuss.org/topic/add-reflect-isconstructor-and-reflect-iscallable. > Died off again. > > There's no issue with ES7 vs. ES6 without a spec, and having a draft spec at > the right stage (1 for flagged implementation?) is the thing. Who will do it? > > /be > > Caitlin Potter wrote: >> **disclaimer** I know this has been brought up before, but bump :> >> >> People are experimenting with polyfilled class implementations, which don’t >> all correctly throw when called as a function (no `new`). Eventually, >> they’re likely to be disappointed that this isn’t legal, and might have to >> undergo some serious pains to fix their applications. >> >> I notice that this is particularly problematic for AngularJS, because >> classes are registered with an injector, which doesn’t know if it can >> `[[Call]]` them or not. It will later on try to `[[Call]]` (depending on how >> the class was registered with DI). It would be really great if we had a way >> to determine if this was going to throw or not, other than looking at the >> stringified value of a function, so that these libraries could be updated to >> accomodate new class behaviour without pains (try/catch or processing >> Function.toString()) >> >> Some ideas: >> >> Reflect.isConstructor(fn) -> true if Class constructor, generator, or >> legacy (and non-builtin) function syntactic form >> Reflect.isCallable(fn) -> true for pretty much any function, except for >> class constructors and a few builtins >> >> I know it’s way too late for ES6, but maybe some kind of fast-tracked >> extension is in order? it should be pretty simple to implement these (and SM >> and v8 have variations of these in the runtime anyways) >> >> _______________________________________________ >> es-discuss mailing list >> [email protected] >> https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

