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

Support pattern matching on case classes with named parameters, not just positional #5323

Closed
scabug opened this issue Dec 16, 2011 · 6 comments

Comments

@scabug
Copy link

scabug commented Dec 16, 2011

I've occasionally wanted this, and "Sophie" recently asked on scala-user list if it was possible:

{code}
case class Rectangle(height: Int, width: Int)
{code}
Instead of pattern matching by position:
{code}
       case Rectangle(_, w) => use(w)
{code}
 
Can I use the field label, something like:
{code}
       case Rectangle(width = w) => use(w)
{code}

FWIW if I had the ability to set the priority to Minor, I would! :)

@scabug
Copy link
Author

scabug commented Dec 16, 2011

Imported From: https://issues.scala-lang.org/browse/SI-5323?orig=1
Reporter: @acruise
Duplicates #6524

@scabug
Copy link
Author

scabug commented Dec 16, 2011

@acruise said:
Quote/code syntax

@scabug
Copy link
Author

scabug commented Dec 16, 2011

@adriaanm said:
changed to minor as requested :)

@scabug
Copy link
Author

scabug commented Oct 21, 2012

@OlegYch said:
promoted back to major #6524 %)

@scabug
Copy link
Author

scabug commented Jul 10, 2013

@adriaanm said:
Unassigning as milestone deadline was reached.

@scabug
Copy link
Author

scabug commented Mar 16, 2017

@SethTisue said:
#6524 is newer, but is more comprehensive and has more discussion and links, so I'll close this one.

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

No branches or pull requests

1 participant