On Feb 27, 2015, at 12:27 AM, Leon Arnott wrote: > 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.
Each meta property is its own special form with its own unique semantics. Of course, consistency among similarly named meta properties is nice, but we have to balance that against the fact that we have a quite limited set of keywords available that we can use for forming meta properties. > > 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. The meta property syntactic pattern is: <reserved word> . <IdentifierName> . Replacing <reserved word> with a sequence special characters is something that was not discussed when we adopted that pattern for new.target. However, past attempts assign special meaning to special character sequences have not been well received. > > 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. > Allen _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

