Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax confliction #39

Open
hax opened this issue Jul 2, 2019 · 1 comment
Open

Syntax confliction #39

hax opened this issue Jul 2, 2019 · 1 comment

Comments

@hax
Copy link

hax commented Jul 2, 2019

f(arg) {
   ...
}

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:

const x = {
  key: () => {...}
}

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:

const x = {
  key: f() {...}
}

Currently it will cause syntax error, with this proposal, oops...

@SiddharthShyniben
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants