Scoped binding of a method to an object

Benjamin (Inglor) Gruenbaum inglor at gmail.com
Sun Oct 13 11:19:24 PDT 2013


Keeping a third parameter beyond object and property name seems
unnecessary.

In my likely naive eyes, dynamic  `this` gives us great power here.
Thinking about other languages that deal with the problem. As far as I
remember C# extension methods are just (really nice) syntactic sugar for
statics.

Is it difficult to convert something like:

```
Array.prototype.last = function(){ return this[this.length-1] }
```

To something like

```
function Array$prototype$last(param1){ return (function(){ return
this[this.length-1] }).call(param1); }
```

?

---------- Forwarded message ----------
From: Erik Arvidsson <erik.arvidsson at gmail.com>
To: Brendan Eich <brendan at mozilla.com>
Cc: es-discuss <es-discuss at mozilla.org>
Date: Sun, 13 Oct 2013 13:32:23 -0400
Subject: Re: Scoped binding of a method to an object
We did proposes this back in 2011

http://wiki.ecmascript.org/doku.php?id=strawman:scoped_object_extensions

I wasn't at this actual F2F meeting so I don't know many details.
Brendan might remember what the blocking issue was?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20131013/d2bd685a/attachment.html>


More information about the es-discuss mailing list