Improving Function.prototype.bind

John J Barton johnjbarton at johnjbarton.com
Sun Jan 8 19:20:52 PST 2012


On Sun, Jan 8, 2012 at 3:35 PM, Brendan Eich <brendan at mozilla.com> wrote:

>
> Anyway, this is all water under the bridge. What about the future? My
> position is still do the library work and popularize. Even if you really
> need a fast-track ES.next solution, the library work must come first.
>
>
I'm not asking for any fast-track; I think library-first makes a lot of
sense. I am also asking "What about the future?".

Library work provides evidence of need and an example of progress. But
every solution has trade-offs. Adopting a library solution is easy: it will
have champions and evidence. Somehow we need to go around the loop
(quickly) to find evidence of the downsides and more input to finding
improvements. I think today ES has a lot of good contributors that can
help. So a concrete suggestions: modify your stance on "library first" to
ask for evidence of revision. Perhaps we can create a world where Master
student projects build the pro/con cases for these smaller but critical
language features. Make the goal less "standardize libraries" and more
"learn/revise/retry from libraries".  Some how the bind()-like functions so
critical to daily use need more attention.


> Firebug uses a library bind a lot, and we continually struggled with the
> memoization problem; we did not try to solve it in part because we hated
> Firebug's bind: it made debugging even more painful since it messes up the
> call stack. Using the ES bind() ends up not being a win, since I now have
> exactly the same problems.
>
>
> I have a question: why is bind used so much in Firebug for event
> listeners, when the DOM guarantees to dispatch them with the event target
> bound to |this|? Way back in '95, I created event handlers but did not add
> bind (it had to be discovered later). But dynamic |this| binding combined
> with DOM event target-based listening and handling kept this properly
> bound. What has changed?
>
> Sorry I don't know what you mean here.

jjb
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120108/a6661708/attachment.html>


More information about the es-discuss mailing list