arrows and a proposed softCall
Irakli Gozalishvili
rfobic at gmail.com
Tue Jun 5 17:25:16 PDT 2012
I would also like to express that I think => with proposed (bound this) semantics, are great. And I don't think it introduces any new issues it's just a sugar for:
function() { /* … */ }.bind(this)
Regards
--
Irakli Gozalishvili
Web: http://www.jeditoolkit.com/
On Tuesday, 2012-06-05 at 12:06 , Russell Leggett wrote:
> On Tue, Jun 5, 2012 at 2:30 PM, Angus Croll <anguscroll at gmail.com (mailto:anguscroll at gmail.com)> wrote:
> > Yes the thread needs wrapping up. Maybe I can attempt summarize the dilemma - with a question:
> >
> > Is call/apply just a remedy for non-lexical this assignment? Or is it a powerful feature in it own right.
> >
> > I'm with the second camp, but I think I'm in the minority in this list
>
> Call/apply are of course powerful features, but they should not be used just for the sake of using them. You know what's cleaner looking than call/apply? Just calling the function directly!
>
> I think the bigger, but related question is, "When should dynamic |this| be used?" Do you think the jQuery style of using the dynamic this in callback is good? Many of us here do not. Dynamic |this| allows for functions to work like methods - it enables mixins and all kinds of meta-programming goodness. However, it can also be abused, and create really funky code that can lead to weird surprises.
>
> Maybe I'm just conservative here. I suppose I can see the appeal of not having to add that pesky extra parameter and instead use |this| for whatever arbitrary thing you might want to put there, but it sure seems less readable to me. You might as well just use the arguments object for everything instead having parameter names!
>
> Until now, with the addition of bind, and the fat arrow, there were a lot of common cases where you would have to put a callback method back with its original |this| object. That is one use of call/apply, and one that will hopefully need less use. Another nice use of it was to easily delegate by using apply and passing through the arguments object. That will go away with rest parameters. So yeah, we might be seeing less of call/apply with ES6, but I think we're replacing them with better patterns instead of just saying they aren't useful anymore.
>
> - Russ
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org (mailto: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/20120605/3efcfc42/attachment.html>
More information about the es-discuss
mailing list