Computed key #11
Replies: 1 comment
-
Supporting spaces and other characters outside the range of IdentifierName seems unrelated to the question of whether computed property keys are supported. void {
notComputed: 1,
"also not computed": 2,
3: "neither was this one",
["this one is computed"]: 4
} The first three there are all alternatives of LiteralPropertyName (IdentifierName, StringLiteral, NumericLiteral). The last is ComputedPropertyName, a bracketed AssignmentExpression. Only the last has observable runtime semantics. (One could probably argue that the quoted form is “least computed” in a sense — or “least sugary” is probably a better way to put it. Property keys are strings and symbols, not identifiers and numbers and strings and symbols.) |
Beta Was this translation helpful? Give feedback.
-
Should the key be computed property key?
Problem
The full dynamic computed property key conflicts with inline-able (#4) and hoistable declaration (#18).
It also conflicts with
[Symbol.iterator]
(#17).Space or special character inside an enum is not common. Excluding this case can simplify the proposal.
Should we support this case?
Beta Was this translation helpful? Give feedback.
All reactions