Well, it depends upon implementations actually adhering to the typeof specification (which may take some time to come about). In ES5 IsCallable is a specification device that essentially means you really truly can call it (which is what it means to have a [[Call]] specification method).
Allen >-----Original Message----- >From: Mark S. Miller [mailto:[email protected]] >Sent: Friday, June 05, 2009 2:19 PM >To: Allen Wirfs-Brock >Cc: Garrett Smith; es-discuss >Subject: Re: Using IsCallable Operation? > >On Fri, Jun 5, 2009 at 1:39 PM, Allen Wirfs-Brock ><[email protected]> wrote: >> 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. > >Why is this an approximation? In ES5, how can > typeof x === 'function' >differ from testing whether something is callable? > >-- > Cheers, > --MarkM _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

