Exotic OBJECT?

Allen Wirfs-Brock allen at wirfs-brock.com
Tue Aug 12 22:34:39 PDT 2014


On Aug 12, 2014, at 7:52 PM, Garrett Smith wrote:

> On 8/12/14, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:
>> 
>> On Aug 12, 2014, at 2:17 PM, Garrett Smith wrote:
>> 
>>> On 8/12/14, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:
> 
> [...]
> 
>>> | Function.prototype.toString
>>> | ...
>>> |
>>> | The toString function is not generic; it throws a
>>> | TypeError exception if its this value does not have
>>> | a [[Call]] internal method. Therefore, it cannot be
>>> | transferred to other kinds of objects for use as a method.
>> 
>> This is a spec, bug. should probably be expressed as does not have a
>> [[Code]] internal slot.
>> 
> 
> What is the [[Code]] for host methods like addEventListener? And what
> is the expected result of addEventListener.toString()?
> 
> Spec for Function.prototype.toString has never reflected reality for
> host methods.


Tweaking spec. text as we go.  The guard is actually going to be: either has a [[Code]] internal slot or is a Built-in function object (see http://people.mozilla.org/~jorendorff/es6-draft.html#sec-built-in-function-objects ). Which is pretty much just a way of saying a function whose implementation details F.p.toString understands.

As long as addEventListener is implemented as a built-in function (whatever that means for the implementation) then f.p.toString should be able to deal with it.

Allen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140812/f85461b6/attachment.html>


More information about the es-discuss mailing list