Necessity of a syntax construct for bind

Brendan Eich brendan at mozilla.com
Wed Aug 31 12:16:54 PDT 2011


On Aug 31, 2011, at 2:28 AM, David Bruant wrote:

> Le 31/08/2011 10:52, Lasse Reichstein a écrit :
>> 
>> 
>> 
>> On Tue, Aug 30, 2011 at 11:46 PM, David Bruant <david.bruant at labri.fr> wrote:
>> Le 30/08/2011 21:59, Lasse Reichstein a écrit :
>>> A reliable .call could probably also achieve the same.
>> A reliable .call could be achieved by composing a reliable .bind and the function call syntax.
>> 
>> True. The Bind operation is the currying of the Call operation. 
>> 
>> Ah, that got me thinking. I can do
>>   var CallFunction = Function.prototype.call.bind(Function.prototype.call);
>> since bind does give a different way to set the this-object for a call. This can be done once, before anybody gets to mangle the builtins, and can be stored for afterwards. Excellent!
> Brilliant!

That is a head-spinner -- well-done, Lasse.

/be

> Of course, it requires a native Function.prototype.bind, but that's brilliant!
> 
> David
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

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


More information about the es-discuss mailing list