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

Re: Removing 'caller' from WebIDL

From: Mark S. Miller <erights@google.com>
Date: Thu, 25 Aug 2011 22:28:18 -0700
Message-ID: <CABHxS9iLqYGzVCekppxZE1SyM1iv72eUEJkG7TOdCzhqV7PsMg@mail.gmail.com>
To: Cameron McCormack <cam@mcc.id.au>
Cc: Jonas Sicking <jonas@sicking.cc>, public-script-coord@w3.org
On Thu, Aug 25, 2011 at 9:36 PM, Cameron McCormack <cam@mcc.id.au> 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".


To be clear, the ES5.1 spec requires that all callable objects have typeof
"function", not just objects implemented in JavaScript. document.all is a
known oddball. It violates the ES5.1 spec in more severe ways than just
this, so it shouldn't be taken as a precedent for propagating spec breakage
elsewhere. The top hit when googling "document.all" is a page titled "Donít
use document.all".




>  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.
>

Whether or not they are function objects is still a choice. By the ES5.1
spec, callable objects must have typeof "function". Functions must have
[[Class]] "Function". Technically, objects not implemented in JavaScript can
be callables without being functions, though it is a bad idea unless
demanded for legacy compat.

I favor removing "callable" from WebIDL if we can.

-- 
    Cheers,
    --MarkM
Received on Friday, 26 August 2011 05:28:51 UTC

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