Types#
Use a type for named fields, an enum for a fixed set of cases, an interface for operations a caller needs, and generics to reuse a model across element types.
| Concept | What you will learn |
|---|---|
| Types and nominal types | Declare mutable fields and distinguish domain identifiers. |
| Enums | Represent a fixed set of possibilities with tagged cases. |
| Collections | Use mutable lists, maps, and sets with explicit deep copies. |
| Optional values | Represent absence explicitly with T? and null. |
| Mutation and references | Understand moves, borrows, reassignment, and deep copies. |
| Destructuring bindings | Unpack list positions and fields. |
| Interfaces and implementations | Satisfy interfaces with concrete or generic methods and pass concrete values where an interface is expected. |
| Equality and hashing | Understand value comparison and key eligibility. |
| Generics and bounds | Apply parameterized types and express required properties. |
| Type compatibility and expected types | Check exact types, contextual constructors, and inference boundaries. |
| Graphs and cycles | Model graphs, parent links, and cycles with indexes and handles. |