Using IsCallable Operation?

2009-06-05 Thread Garrett Smith
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:-

RE: Using IsCallable Operation?

2009-06-05 Thread Allen Wirfs-Brock
, 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

Re: Using IsCallable Operation?

2009-06-05 Thread Mark S. Miller
On Fri, Jun 5, 2009 at 1:39 PM, Allen Wirfs-Brock allen.wirfs-br...@microsoft.com 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]]

RE: Using IsCallable Operation?

2009-06-05 Thread Allen Wirfs-Brock
-Original Message- From: Mark S. Miller [mailto:erig...@google.com] 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 allen.wirfs-br...@microsoft.com wrote

Re: Using IsCallable Operation?

2009-06-05 Thread Garrett Smith
On Fri, Jun 5, 2009 at 2:18 PM, Mark S. Millererig...@google.com wrote: On Fri, Jun 5, 2009 at 1:39 PM, Allen Wirfs-Brock allen.wirfs-br...@microsoft.com wrote: Not in ES5.  Generally checking that typeof x === 'function' is a close approximation. ES5 (11.4.3) requires that  both native (ie,

Re: Using IsCallable Operation?

2009-06-05 Thread Mark S. Miller
On Fri, Jun 5, 2009 at 7:22 PM, Garrett Smith dhtmlkitc...@gmail.comwrote: function isCallable(obj, prop) { var type = typeof obj[prop]; if(isNewTypeof) { return type === function; } else { // fallback best practice. } } function isCallable(obj, prop) { var type = typeof