Binding arrow functions.

Till Schneidereit till at tillschneidereit.net
Mon Aug 25 02:54:57 PDT 2014


On Mon, Aug 25, 2014 at 4:30 AM, Boris Zbarsky <bzbarsky at mit.edu> wrote:

> On 8/24/14, 10:26 PM, Mark Everitt wrote:
>
>> The problem remains that arrow functions make
>> bind etc. unpredictable.
>>
>
> I think part of Domenic's point is that return values of bind() also make
> bind (and call/apply for that matter) unpredictable.
>

More fundamentally, I guess you could say that every function that doesn't
use `this` makes `bind` unpredictable. Domenic's second example shows a
function like that.

I would argue that, if anything, arrow functions slightly improve
predictability: before arrow functions, the only way to meaningfully
"predict" the change in behavior that `bind` causes for a functions was by
looking at its source code *and by ensuring that the function hasn't been
bound already*. For arrow functions, you only need to inspect the source
code. (Granted, this probably isn't *that* much of a real-world
improvement.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140825/adb962e7/attachment.html>


More information about the es-discuss mailing list