Changes to apply/call this coercion (was: ES3.1 Draft: 27 Oct 2008 version available)

Robert Sayre sayrer at gmail.com
Mon Oct 27 12:04:16 PDT 2008


Pratap Lakshman (VJ#SDK) wrote:
>
> I have uploaded to the wiki (link <http://wiki.ecmascript.org/doku.php?id=es3.1:es3.1_proposal_working_draft>) the 27 Oct 2008 draft of the specification for ES3.1. This is in the form of in-place edits and markups to the ES3 specification. Revision history is at the end of the document.


(I see multiple problems with these edits--I will address them separately)

These edits to call and apply look like unacceptable, incompatible
changes to ECMAScript-262 3rd edition.

The following test passes in JS shells from Mozilla, WebKit, and Chrome:

----------------

this.foo = "bar";

function test(didPass, name) {
   print((didPass ? "PASS" : "FAIL") + " " + name);
}

var f = function() {
   test(this.foo == "bar", "undefined/null thisArg");
}

var g = function() {
   test(this.foo == "qux", "thisArg supplied");
}

function testApplyAndCall() {
   f.apply(undefined, []);
   f.apply(null, []);

   f.call(undefined);
   f.call(null);

   var obj = {foo: "qux"};

   g.apply(obj, []);
   g.apply(obj, []);

   g.call(obj);
   g.call(obj);
}

testApplyAndCall();

----------------

- Rob


-- 

Robert Sayre

"I would have written a shorter letter, but I did not have the time."


More information about the Es-discuss mailing list