Function.prototype.bind (was: Topic list - pending changes and issues for the ES3.1 spec)

Mark S. Miller erights at
Tue Sep 9 10:39:19 PDT 2008

On Tue, Sep 9, 2008 at 9:21 AM, Mark S. Miller <erights at> wrote:
> I still need to spec Function.prototype.bind in our funny spec language.
>    Anyone care to contribute a draft?

The simplest way to specify this would be in terms of the rest of the
ES3.1 spec, i.e., a "self-hosting" spec. Perhaps like the following:

  Function.prototype.bind = function(self, var_args) {
    var thisFunc = this;
    var leftArgs = Array.slice(arguments, 1);
    return function(var_args) {
      var args = leftArgs.concat(Array.slice(arguments, 0));
      return thisFunc.apply(self, args);

Post ES3.1, we hope to turn in general to the specification style that
had been used for the ES4 spec -- SML + self-hosting. However, even
the ES3 spec does make some use of self-hosting language such as "as
if by the expression 'new Object()'", which the ES3.1 draft keeps, but
clarifies to refer to the original binding of 'Object'. Could we use
the same trick for Function.prototype.bind by saying something like
"the original bindings of Array.slice, Array.prototype.concat, and
Function.prototype.apply? Post ES3.1, to enable self-hosting specs,
we'll need to solve this problem anyway. Any ideas how we should do
that then?


More information about the Es-discuss mailing list