Why did Rust go with "match" instead of "switch" or "case"?

I am curious about the history of this. I would suggest that C / C ++ / Java / etc programmers would like a switch and thus become a natural choice. If I would like to avoid confusion in semantics (since match more powerful than switch ), I would assume that he would take case from Haskell instead.

+6
source share
1 answer

The Rust link refers to Standard ML (SML) and OCaml as an effect on pattern matching. In OCaml, pattern matching uses the match keyword .

The original Rust compiler is written in OCaml , so it makes sense that OCaml would have a stronger influence on Rust than, say, Haskell.

+10
source

Source: https://habr.com/ru/post/1011633/


All Articles