Open hax opened 5 years ago
const x = {
key: f() {...}
}
becomes
const x = {
key: f(() => {...})
}
and unless f
is defined, you are still getting a ReferenceError
. And if f
is defined, x.key
might not be a function, leading to another error. You'll have to be really lucky if f
returns a function.
As current syntax of this proposal, such code will have different semantic in/not in the class body, which is very confusing, error-prone, and harm to code review.
Another example of error:
Someone may refactor the code from arrow function to plain function for some reason (for example, need name for recursion), and just forgot the
function
keyword:Currently it will cause syntax error, with this proposal, oops...