English
Summary
Conclusions
Records describe values through components, enum defines a finite set of constants, sealed restricts alternatives, and patterns let you safely examine their structure. Compact syntax does not eliminate the need for invariants, defensive copies, or numeric bounds checks.
Self-check questions
- Which members does a record generate?
- When are the fields assigned in a compact constructor?
- Why is a record with an array not automatically immutable?
- Why should ordinal not be stored as an external code?
- How does enum combine fields and behavior?
- Which modifiers do direct subtypes of sealed types have?
- What does dominance of a switch case mean?
- Why does default not replace case null?
- What do var and the underscore do in patterns?
- How do you verify that simplification preserves semantics?