Givens and Contextual Abstractions
- given and using. given declares a contextual value; using parameters receive it: capabilities passed implicitly, declared explicitly.
- Type classes. A type class is a trait plus givens per type: behaviour added to types you do not own.
- Where implicits went. Scala 3 replaced implicit soup with givens: findable by the compiler and the reader alike.
Extension Methods
- extension. extension methods add syntax to existing types: extension (s: String) def slug: String.
- Discoverability. Extensions live in objects and imports make them visible: magic that announces itself.
- Enriching libraries. Extensions plus type classes enrich third-party types safely: no monkey-patching, all checked.
Modern Scala Design
- Optional braces. Scala 3’s indentation syntax reads like prose: braces optional, structure unchanged.
- Export clauses. export forwards members from a component: composition with inheritance’s ergonomics.
- Simplicity budget. Scala 3 style spends cleverness sparingly: the powerful features exist for libraries, not every file.
Before and after this level
- Before: Level 6: Type System: Generics, Variance, Type Bounds and Advanced Types.
- Next: Level 8: Errors & Effects: Option and Either, Effectful Computation Concepts, Reliable Functional Error Handling.
In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See Checkpoints and flashcards.
Frequently asked questions
What does Scala Level 7: Scala 3 Features cover?
Givens and Contextual Abstractions, Extension Methods, Modern Scala Design: 3 lessons and 9 ideas.
What should I know before this level?
The level before it, Level 6: Type System, which covers Generics, Variance, Type Bounds and Advanced Types.