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

Should we allow "PrivateIdentifier: MatchElement" under a MatchProperty? #250

Open
JLHwung opened this issue Mar 23, 2022 · 2 comments
Open

Comments

@JLHwung
Copy link
Contributor

JLHwung commented Mar 23, 2022

For example,

Class C {
  #x;
 foo(obj) {
    match (obj) {
      when ({ #x: 42 }) { /* do something */ }
    }
  }
}

I think eventually we should, just like we are extending destructuring for private identifiers. I am either good with including it in this proposal or delegate it to a new one.

@ljharb
Copy link
Member

ljharb commented Mar 23, 2022

I think if that proposal advances, we must handle it in this proposal, and probably already need to. This proposal must match destructuring, pun intended.

@tabatkins
Copy link
Collaborator

Agreed. Because we've been careful so far about keeping pattern syntax very close to destructuring, we can accommodate this cleanly and easily in exactly the same way destructuring does.

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

3 participants