Skip to content

Nomenclature question: what is the EXPR in for PATTERN in EXPR { } called? #1841

Open
@jieyouxu

Description

@jieyouxu

Location

https://doc.rust-lang.org/reference/expressions/loop-expr.html#iterator-loops

Context

I was reviewing a test cleanup PR rust-lang/rust#141974, and I was trying to say something about the EXPR in

for PATTERN in EXPR {
    //         ^--- what is this expr called?
    // ...
}

but I couldn't find a good term for this12. The current grammar calls this EXPR

Expressionexcept struct expression

whereas for e.g. match EXPR { .. } or if let PATTERN = EXPR { .. }, there's a more "meaningful name" for that EXPR, which is the scrutinee expr.

Footnotes

  1. In the community discord, terms like "interatee" or "iterable" or "into-iterable" were suggested, but yeah.

  2. Nadrieril came up with "loopee", which is an excellent term 😆

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