I feel a little unhappy that one meta-property, `new.target`, is lexically scoped in arrow functions but these new ones aren't, without much obviously distinguishing them. I guess you could concoct the reasoning that since arrows can't be `new`'d, `new.[meta-property]` is "meaningless" in it - but that feels like the sort of explanation that makes more sense retrospectively.
On a different tack: I also feel like `new.target` has a significant readability advantage which `function.[meta-property]` sadly doesn't have: the `new` operator appears in (almost) all actions which set the value of `new.target`. Its visual continuity reinforces the meaning of the meta-property. I think instead of `function.[meta-property]` it should *really* be `().[meta-property]` - which means `[call operator].[meta-property]`. The round-bracket call operator is in many ways the counterpart to "new" (consider the coincidence that it is optional when "new" is used and no arguments are passed) whereas "function" is much less connected to the notion of calling, and is rapidly growing less connected to function object creation at all. Also, consider the phrasing of the meta-properties: `().arguments` now means "the arguments that the () was given", which to my ears rings clearer than `function.arguments` "the arguments that this function instantiation (not the function object) was given". (And do you not think it looks a little too similar to `Function.arguments`, which is semantically *and* syntactically completely different?) I'm not sure if it's possible in the grammar for these proposed names to become `().callee`, `().count`, `().arguments` etc. (insofar as the actual call and property access operators strongly resemble them), but I think it should be considered.
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

