This chapter provides an overview of Slang’s pattern matching facilities. Pattern matching provides a powerful and understandable notation for accessing the elements of data structures.

Add comments on testing, reasoning by cases, implicit control structures. Challenging for compilation, static analysis, and verification

Pattern matching was originally introduced in functional programming languages, but has now been adopted in many modern languages. Slang’s pattern matching is a restriction and modification of Scala’s pattern matching facilities. One important semantic difference from Scala is that Slang’s pattern matching maintains the Slang “copy semantics” for avoiding aliasing for mutable structures.