Skip to content

Nested tuple unpacking #13439

@bpr

Description

@bpr

#12412 # Summary
The following fails:

const foo = ("Pi", (3.141, 5))
let (name, (fv, i)) = foo
echo("Name=", name, " fv = ", fv, "i = ", i)

Description

Obvious

Alternatives

One alternative is to use single level tuples and unwrap each nesting separately.

const foo = ("Pi", (3.141, 5))
let (name, fvi) = foo
let (fv, i) = fvi
echo("Name=", name, " fv = ", fv, "i = ", i)

Having nested tuples work without this limitation seems more Nim-ish to me. If it makes it easier, I'd be fine with mandatory parens on tuples.

Additional Information

#10152
#2436

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