On Mar 27, 2012, at 9:14 PM, Russell Leggett wrote:
> I'm sure this is a bit of a tangent, but the other major related case is
> passing a "method" as an argument but needing to retain the correct "this".
> Obviously, that is what bind was meant for, but that is inconvenient when
> passing methods for the same reason it would be inconvenient for anonymous
> functions.
>
> What if we had a shorthand for bind that worked in both of these cases...
I have a strawman on this topic:
http://wiki.ecmascript.org/doku.php?id=strawman:bind_operator
I agree it's a real need. Just like ... will provide convenient, high-fidelity
(e.g., insensitive to Function.prototype monkey-patching) syntax for .apply, we
should also have an operator that provides convenient, high-fidelity syntax for
.call and .bind. I believe a single operator can provide both.
Dave
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss