Function constants for Identity and No-op
Michał Wadas
michalwadas at gmail.com
Wed Aug 10 15:55:36 UTC 2016
Function.isFunction was a joke, I'm pretty sure that only very old legacy
code deals with document.all and crazy stuff like that (however, it would
be useful, but saving me from typing few more characters isn't something
urgent or important).
On 10 Aug 2016 5:46 p.m., "Peter van der Zee" <ecma at qfox.nl> wrote:
> >> What's the issue with document.createElement('object')?
>
> > It's a callable exotic object.
>
> >> Function.isFunction? :D
>
> > typeof is what you are looking for.
>
> There is precedent (at least in IE [1]) for exotic functions where
> `typeof` returned "unknown". Could happen for any exotic value unless
> the spec changed on that. An `isFunction`, or rather, a simple
> `isCallable`, may not be that far off the mark and is in line with the
> existing `isArray`. Though I'd much rather have callables invariantly
> locked down to being "typeof function". Even if that means explicit
> exceptions to some legacy cases.
>
> - peter
>
> PS. Regexes in firefox were "callable" and had typeof function, but I
> think that's so far back [2] it's not super relevant here. Of course
> the same could be said about the IE case.
>
> [1]; one of many examples:
> http://stackoverflow.com/questions/10982739/typeof-returning-unknown-in-ie
> [2]; https://bugzilla.mozilla.org/show_bug.cgi?id=61911
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160810/48edb64b/attachment.html>
More information about the es-discuss
mailing list