Skip to content

Chapter 6.2: Describing "match" as an operator is surprising #2859

Closed
rust-lang/rust
#92546
@jruderman

Description

@jruderman
  • I have checked the latest main branch to see if this has already been fixed
  • I have searched existing issues and pull requests for duplicates

URL to the section(s) of the book with this problem:

https://doc.rust-lang.org/book/ch06-02-match.html

Description of the problem:

The match Control Flow Operator

Rust has an extremely powerful control flow operator called match that allows you to compare a value against a series of patterns and then execute code based on which pattern matches.

The term "operator" most centrally refers to symbols that act on values to produce values. match is pretty far from this: it's a keyword that works with patterns to affect control flow.

I think it is better to describe match as a "keyword", "expression", or "control flow construct". (Any of these would be consistent with other parts of the book: chapter 3.5 refers to match as a "branching construct"; chapter 6.1 refers to match as both an "expression" and a "control flow construct"; chapter 18 uses the phrase "match expressions".)

Suggested fix:

  • The section title could be any of:
    • Flexible Control Flow with match
    • The match Control Flow Construct
    • match Control Flow Expressions
  • For the sentence:
    • Change "control flow operator" to "control flow construct"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions