On Sat, May 1, 2010 at 10:13 AM, Brendan Eich <[email protected]> wrote:

> On May 1, 2010, at 3:28 AM, Jürg Lehni wrote:
>
> On 1 May 2010, at 01:50, Brendan Eich wrote:
>
> MooTools takes an array of actual arguments to bind, while the others take
> trailing positional actual params, I see. My point was that however they are
> passed, these values are bound to the leading arguments supplied when the
> bound method is invoked.
>
>
> I just performed the same test on Mootools, no argument concatenation seems
> to happen there:
>
> function test() {
> alert($A(arguments));
> }
>
> test(1, 2, 3); // "1, 2, 3"
>
> var test2 = test.bind(this, [1, 2, 3]);
>
> test2(); // "1, 2, 3"
>
> test2(4, 5); // "1, 2, 3
>
>
> Odd, that is neither fish nor fowl. Does any other library have such a
> bind?
>
> Anyway, Moo was not around when TC39 was looking at bind, or at least, it
> was not on our radar.
>

I see that Dojo does same thing as Prototype — concats bound and "runtime"
arguments together (http://api.dojotoolkit.org/jsdoc/HEAD/dojo.hitch):

dojo.hitch({}, function(){return arguments}, 1, 2)(3, 4); // [1,2,3,4]

This article from 2004 gives a glimpse into some of the rationale behind
Prototype's bind (IIRC, it is that paper that influenced Prototype to
include `bind`) — http://www.brockman.se/2004/method-references/

It also shows an example of why adding support for partial application to
`bind` could be useful.

-- 
kangax
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to