Re: Removing 'caller' from WebIDL

On Aug 25, 2011, at 9:36 PM, Cameron McCormack wrote:

> On 26/08/11 8:21 AM, Jonas Sicking wrote:
>> My understanding is that this convention is not implementable in Javascript.
> 
> Perhaps a minor point, but the part that is not implementable in pure JS is having document.all be callable while having it also be typeof "object".

This is also required by the ES5/5.1 specification which defines typeof as:
"
Type of val                                             Result
---------------------------------------------------------
Object  (native and does not                 "object"
implemented [[Call]])
--------------------------------------------------------
Object (native or host and                     "function"
does implemented [[Call]])
--------------------------------------------------------
 Object  host and does not                   "object"
implemented [[Call]])
--------------------------------------------------------
"  (section 11.4.3)

In other words any object, including host objects that implements [[Call]] must yield "function" for typeof.

> I haven't heard of any of the other collection objects that currently have callers in the spec being required to be typeof "object", so IF we were to decide that the pattern of callable objects in general was desirable (and I am not nearly convinced that it is) then we could define those ones to be Function objects, and leave document.all to be the odd one.
> 

Received on Friday, 26 August 2011 05:33:39 UTC