W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2011

Re: Removing 'caller' from WebIDL

From: Allen Wirfs-Brock <allen@wirfs-brock.com>
Date: Thu, 25 Aug 2011 22:33:04 -0700
Cc: Jonas Sicking <jonas@sicking.cc>, public-script-coord@w3.org
Message-Id: <9A3C664D-2179-43EA-9319-DC5861C79786@wirfs-brock.com>
To: Cameron McCormack <cam@mcc.id.au>

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

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:04 UTC