Using IsCallable Operation?

Allen Wirfs-Brock Allen.Wirfs-Brock at microsoft.com
Fri Jun 5 13:39:01 PDT 2009


Not in ES5.  Generally checking that typeof x === 'function' is a close approximation. ES5 (11.4.3) requires that  both native (ie, pure actual ECMAScript objects) and host objects that implement [[Call]] produce "function" when typeof is applied to them.  This is a change from ES3 that did not impose this requirement upon host object objects.

Of course it may take a while for browser implementations to respond to this change.

Allen

>-----Original Message-----
>From: es-discuss-bounces at mozilla.org [mailto:es-discuss-
>bounces at mozilla.org] On Behalf Of Garrett Smith
>Sent: Friday, June 05, 2009 1:31 PM
>To: es-discuss
>Subject: Using IsCallable Operation?
>
>There seems to be a lot of controversy on how to properly check if
>something should be callable. There isn't any way to determine that in
>ES3.
>
>The internal IsCallable determines if an object has a [[Call]] property.
>
>Will that be available as a language feature, not internal?
>
>For example:-
>  Object.isCallable( document.images );
>
>- would provide a check to internal IsCallable and return the result.
>
>Garrett
>_______________________________________________
>es-discuss mailing list
>es-discuss at mozilla.org
>https://mail.mozilla.org/listinfo/es-discuss



More information about the es-discuss mailing list