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

Projects
None yet
1 participant
@scabug
Copy link

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

This comment has been minimized.

Copy link
Author

commented Dec 16, 2011

@scabug

This comment has been minimized.

Copy link
Author

commented Dec 16, 2011

@acruise said:
Quote/code syntax

@scabug

This comment has been minimized.

Copy link
Author

commented Dec 16, 2011

@adriaanm said:
changed to minor as requested :)

@scabug

This comment has been minimized.

Copy link
Author

commented Oct 21, 2012

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

@scabug

This comment has been minimized.

Copy link
Author

commented Jul 10, 2013

@adriaanm said:
Unassigning as milestone deadline was reached.

@scabug

This comment has been minimized.

Copy link
Author

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
You can’t perform that action at this time.