L12: Delegation and Delegated Properties
What will you learn in this lesson?
Section titled “What will you learn in this lesson?”In this lesson we will explore:
- Deep Theory: First-class interface delegation (
by), standard library property delegates (lazy,Delegates.observable,Delegates.vetoable), and implementing Custom Property Delegates viaReadOnlyProperty/ReadWriteProperty. - Under the Hood: How the compiler generates hidden synthetic fields (
$$delegate) and accessor methods redirecting property calls togetValueandsetValue. - Incremental Lab (AI Chat CLI): Building a custom property delegate to automatically persist message history to disk (
history.txt) whenever state changes.
Navigation
Section titled “Navigation” ← Course Syllabus Return to the full lesson curriculum.
← Previous Lesson (L11) Advanced Generics and Variance.
Next Lesson (L13) → Coroutines vs Traditional Asynchrony.