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

Introduce array spread operator for pattern matching and [<ParamArray>] #27

Closed
baronfel opened this issue Oct 20, 2016 · 0 comments
Closed
Labels

Comments

@baronfel
Copy link
Contributor

baronfel commented Oct 20, 2016

Introduce array spread operator for pattern matching and [] [11462964]

Submitted by Ryan Riley on 1/15/2016 12:00:00 AM
18 votes on UserVoice prior to migration

Several languages have introduced a handy spread operator, ..., that can be used to pick up remaining arguments to a function call or when destructuring values. [1] This would be incredibly helpful in F# to reduce boilerplate in methods accepting a [] or when trying to pattern match arrays:
match [|1;2;3;4|] with
| [||] -> // do stuff with empty array
| [|hd;…tl|] -> // do stuff with hd/tl
[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator

Response

** by fslang-admin on 2/3/2016 12:00:00 AM **

Declined per my comment below. We would not extend pattern matching for this one case, but Rick is right that improvements to active patterns may make sense
Don Syme, F# Language Evolution

Original UserVoice Submission
Archived Uservoice Comments

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

No branches or pull requests

1 participant