Skip to content

tuple destructuring doesn't always work with _ (underscore) #18710

Closed
@a-mr

Description

@a-mr

Tuple desctructuring does not work with underscores if used outside of var section. Inside it it's OK, and that's confusing. It seems Nim sees _ as a special identifier that should be declared.

Example

var x = 0
(x, _) = (1, 2)

Current Output

Error: undeclared identifier: '_'

Expected Output

To work the same way as

var (x, _) = (1, 2)

(This was fixed at some stage, e.g. bug #2421)

Possible Solution

Additional Information

Checked with Nim 1.4 and Nim 1.5 devel.

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