Skip to content

Allow tuples and other irrefutable patterns in parameter specifications #1398

Closed

Description

@nikomatsakis

Currently we can write

for (a, b) in vec::zip(as, bs) { ... }

but not

vec::iter(vec::zip(as, bs)) { |(a, b)| ... }

nor

fn proc((a: A, b: B)) { ... }
vec::iter(vec::zip(as, bs), proc)

It would be nice to have these irrefutable patterns work in parameter specifications, if not in all functions then at least in Ruby-like blocks.

Activity

  1. marijnh commented on Jan 2, 2012

    @marijnh
    Contributor

    I think this is a good idea. It was agreed on to support this during the Toronto meeting, but when I was implementing destructuring bindings I somehow forgot about it. There are some awkward corners to be decided on (we allow param names in fn types -- will we also allow pointless patterns there?), but on the whole this should be straightforward to implement. (Though a lot of code will have to be touched.)

  2. erickt commented on Jun 6, 2012

    @erickt
    Contributor

    Ack! I think I closed this by mistake. However, I think this is a dup of #1881, so I'm going to leave it closed.

  3. added a commit that references this issue on May 2, 2015
  4. added a commit that references this issue on May 2, 2015
  5. added a commit that references this issue on Oct 21, 2023
  6. added a commit that references this issue on Dec 30, 2024
  7. added a commit that references this issue on Jan 2, 2025
  8. added a commit that references this issue on Feb 15, 2025
  9. added a commit that references this issue on Feb 28, 2025
  10. added a commit that references this issue on Feb 28, 2025
  11. added 2 commits that reference this issue on Aug 21, 2026
  12. added a commit that references this issue on Sep 23, 2026
  13. added a commit that references this issue on Sep 23, 2026
  14. added a commit that references this issue on Oct 1, 2026
  15. added a commit that references this issue on Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-frontendArea: Compiler frontend (errors, parsing and HIR)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions