On Fri Feb 27 2015 at 11:56:04 AM Allen Wirfs-Brock <[email protected]>
wrote:
>
> On Feb 27, 2015, at 8:00 AM, Rick Waldron wrote:
>
>
> I was thinking exactly this while I was reading Allen's post.
>
> Would class method definitions use `class.*`? Seems like the wrong
> abstraction..? Maybe all functions and method definitions use `function`,
> while arrows use `=>` (or whatever) to preserve correspondence to
> possible outer function?
>
>
> the point here is that they are all "functions", regardless of how they
> are declared. When we write foo(), we don't care whether 'foo' is was
> declared using a function declaration, or a concise method, or class, or
> arrow syntax. We only care that it is a "function" which is an object that
> can be 'called' with an argument list. That is the exact sense that the
> word 'function' should be interpreted for those proposed meta properties.
>
I agree with you now and here's why:
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.
});
}
Rick
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss