Rick Waldron wrote:
function Component(target) {
let a = function.arguments;
target.on("click", event => {
// In here, `arguments` refers to the `arguments` object
// that was created for this invocation of Component,
// which makes sense because that object has no sense of
// contextual qualification (something of a legacy problem).
function.arguments[0] === a[0]; // false
// ...because `function.arguments` here is for this arrow function.
});
}
Joke's not funny if you have to explain it.
Seriously, I don't buy the explanation. I read the above and I see
`function`used twice. I expect the first use declares Component, and the
second (even though in an arrow, because arrows uphold Tennent's
Correspondence Principal with respect to `this` and `arguments`) to
refer to the activation of the function declared by the first use of
that f-keyword.
I agree with Mark.
/be
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss