Hi there, sorry for intruding in this discussion which hasn't been active for a while.
I just stumbled across this thread as I was actually thinking of opening one like this myself
I just wanted to mention another couple of reasons why this could in my opinion be quite a nice addition
Firstly, I would just like to say that for via function
we can actually define both named and anonymous functions, so it would actually stand to reason to me that the same should be possible with arrow functions as well (without the need to rely on name inference as @ljharb mentioned).
Second (which sort of adds to what @ljharb mentioned), I think that it would be very good for callbacks, those are currently always anonymous (unless you go out of your was and use function
instead) and they usually create various anonymous calls in the call stack which aren't as easily debuggable.
As a very simple example, let's say I have
myArray.forEach(el => { return el+1; });
inside the callback function the call stack would just say that the function is anonymous, and to actually have that function named we'd have to do:
myArray.forEach(function addOne(el){ return el+1; })
(or have define the addOne
arrow function in a previous statement)
it would be quite neat if we could instead do:
myArray.forEach(addOne(el) => { return el+1; });
Of course this is an extremely simple example but with frameworks/libraries which highly depend on callbacks (I am for example thinking of rxjs) it could actually quite improve the developer experience (and defining the arrow functions prior to the callback just so that they can name-inferred could just create clutter)
Anyways I just wanted to mention that