As of ES2015 functions defined without an explicit name get their name from
the variable or property they are assigned to, which is great for
debugging. I want to propose another way a function can get it's name,
which is when anonymous functions (or arrow functions) are defined as
parameter to a function. For example:

```
    function flatMap(list, mapFunc){
      return [].concat(...list.map(mapFunc));
    }

    flatMap([1,2,3], x => throw new Error('oh noes'))
```

In this example the stack trace will not have a name for the lambda that
throws an error. It would be useful if it could take the name of the
flatmap argument (mapFunc).

Marius Gundersen
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to