From Functions to Inlinable Effects in Kotlin
summary
Kotlin uses the inline modifier to make higher-order functions accept suspend and other effectful lambdas by inlining their bodies at call sites so continuations aren’t captured; standard-library methods like forEach, map and filter are inlined to avoid allocations, enable non-local returns and support reified generics at compile time. This eliminates many async/exception “coloring” problems without effect handlers, but inlinable lambdas cannot escape (no storing/serialization), so it works well for small utility APIs but imposes practical limits on what can be marked inline.
AI-written summary · about
chapters (12)
- 0:00Kotlin introduction
- 1:05Basic and higher-order functions
- 2:49Extension functions use cases
- 4:58DSLs with functional types
- 5:58Suspend functions and concurrency
- 8:07Code coloring in Kotlin
- 10:57Suspend functional types challenges
- 13:12Code coloring pitfalls
- 16:45Functional solutions for code coloring
- 19:17Solving code coloring with inline
- 23:54Trade-offs of inline functions
- 25:02Summary
related talks
36mKotlin, Beyond the Basics
46mKotlin 102 - Beyond the basics
52mKotlin: Dissecting the stdlib
27mKotlin Backstage
48mKotlin & Functional Programming: pick the best, skip the rest
39mDiving into advanced Kotlin features
27mWhy Kotlin is my favourite example of Functional Programming?
41mKotlin 102 – Beyond the Basics
