Arrow binding

Mark S. Miller erights at google.com
Mon Apr 23 07:35:33 PDT 2012


On Mon, Apr 23, 2012 at 6:46 AM, Kevin Smith <khs4473 at gmail.com> wrote:

> I'm not sure I understand the reasoning behind "soft-binding".  If I use
> arrow syntax, my intention is to close over |this|.  Allowing a caller to
> change the binding of |this| will result in a violation of that closure.
>  In this respect, |this| within an arrow function is no different that any
> other closed-over variable.  I would not want a caller to be able to
> override the binding on any of those variables, right?


Right. I think this is the key issue regarding defaults and what arrow
functions must do -- hard binding. Making this binding soft would destroy
the integrity of lexical capture that arrow functions provide for "this".

Alex, <http://wiki.ecmascript.org/doku.php?id=strawman:soft_bind>, which we
worked on together, implements soft binding as a simple small library. We
wrote this over a year ago. Since then, I've never found a need for this.
Could you give a concrete example where this is useful? Do such uses
justify a role beyond such library implementations? I'm inclined to YAGNI
on this one.




>
> kevin
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>


-- 
    Cheers,
    --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120423/936a7571/attachment.html>


More information about the es-discuss mailing list