archives

« Bugzilla Issues Index

#2564 — Arrow Function: apply, bind and call


Currently apply, call and bind include no instruction for what to do when invoked on an ArrowFunction object.


I'm also a little confused about ArrowFunction's call to FunctionCreate instead of BoundFunctionCreate, perhaps there's a simple reason that I'm just not seeing?


There is nothing special they need to do. There is no difference between what happens when:
({foo: a=>this /*lexical this */}).foo()
and what happens when a similar arrow function is called via call/apply/bind. Arrow functions internally ignore whatever is pass as the thisValue by a [[Call]] internal method.


Yes, I realize that—what I'm asking is if you think it might be wise to include some instruction to that effect? If you're saying you don't think it's necessary, that's fine too.


fixed in rev26 editor's draft

added a note to call, bind, apply clarify that the thisArg is ignored for bound and arrow functions

I didn't say anything about using FunctionCreate to create arrow functions. I think you've just picked up the meme that an arrow function is similar to saying:
(function () {}.bind(this))
which is actually a pretty low fidelity analogy. I really don't think we need to say anything about that because I don't think there is anything in the spec. that that equates arrow functions and bound functions in that manner.


fixed in rev26