Re: Removing 'caller' from WebIDL

On Thu, 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".

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.


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