Alternative to Function.bind

Igor Bukanov igor at mir2.org
Fri Mar 27 11:42:43 PDT 2009


2009/3/27 Brendan Eich <brendan at mozilla.com>:
>  although perhaps the name should be something else:
>
> obj.bindSelfTo.method
>
> or just
>
> obj.bindTo.method

IMO a better name would be boundedMethods or just bounded to emphasis
that the result is a view that may work with any method like in:

var obj2 = obj.bounded;
...
array.sort(obj2.my_sort);
array.filter(obj2.my_filter);

Igor


More information about the Es-discuss mailing list