Skip to content

Support destructuring in function arguments #1881

Closed

Description

@marijnh

Basically, allow things like fn foo((a, b): (int, int), @u: @something) {}.

We talked about this in the Toronto meeting. I was surprised that no issue existed for it.

Activity

  1. ghost assigned on Feb 22, 2012
  2. Aluminium95 commented on Feb 22, 2012

    @Aluminium95

    Would enum and record support destructuring in function arguments too ?

  3. brson commented on Feb 23, 2012

    @brson
    Contributor

    Do we really need this? I know that occasionally I have thought it would be nice to have, but we have lasted this long without anybody complaining loudly about it, so it doesn't seem vital.

  4. marijnh commented on Feb 23, 2012

    @marijnh
    ContributorAuthor

    It'd be consistent. I occasionally find myself wanting to use this -- mostly for tuple arguments.

  5. brson commented on Feb 23, 2012

    @brson
    Contributor

    I wonder how it would interact with our various argument modes. Does it effectively turn them all into copies? Is it only compatible with certain modes?

  6. marijnh commented on Feb 23, 2012

    @marijnh
    ContributorAuthor

    Hm. I assumed that regular modes (non-copy/move) would be able to just create views into the existing value without copying, since such args are immutable locals, but I guess if that value has mutable components, this would mess with the invariant that locals don't get their values changes from under them.

    For by-copy and by-move the story gets even more involved. Maybe you're right that we shouldn't bother.

  7. marijnh commented on Feb 28, 2012

    @marijnh
    ContributorAuthor

    I'm closing this. If someone feels strongly about supporting this, discuss.

  8. removed their assignment
    on Jun 16, 2014
  9. added a commit that references this issue on Aug 7, 2025
  10. added 3 commits that reference this issue on Aug 21, 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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions