back

by masswerk·12y ago·view on hn ↗
Hmm, reading the Harmony specs, an arrow function asserts ' typeof () => {} === "function"' and 'Object.getPrototypeOf(() => {}) === Function.prototype', but is not subject to `apply` and `call` (for obvious reasons).

Isn't this an issue with patterns, where an object is applied to a callback? It would introduce extensive testing, whether the callback was supplied as a regular function or (erroneously) as an arrow function (which would raise an error). Using try-catch for this would send the whole construct out of JIT-context at the other hand, so it isn't a favorable option.

1 comments
Note: You may still use `call` and `apply` on them to supply arguments, but you may not change the this-object. (So, they are still subject to these calls. But this does not affect the use-case given above, where an object would be applied to a callback.)