Skip to content
0:00 / 0:00

#kotlin#coroutines#inlinefunctions

The Suspend & Inline Mystery | Kotlin Tips 2023

Kotlin by JetBrains

100K subscribers • 61 videos on Hallway

YouTube
  • Recommended by 1 person: 1 in engineering communities.
  • Presented by Sebastian, Developer Advocate at JetBrains
  • Made by the vendor. The company whose product it covers made or sponsored it.

Intermediate. Assumes working knowledge.

15K views4 years ago1 recommendation

Programming languagesKotlinConcurrency and parallelismPerformance and optimization

Sebastian explains how Kotlin's inline modifier allows standard library functions to accept suspending functions in their lambdas.

How come functions like `repeat`, `map` and `filter` accept suspending functions in their lambdas, even though their signatures aren’t coroutines-aware? In this episode of Kotlin Tips Sebastian (twitter.com/sebi_io) solves the riddle: It has something to do with the inline modifier. #Kotlin #kotlinTips #JetBrains #programming

Why it's here

1 person recommends this

What people say. Recommended as a quick and clear explanation of how Kotlin's inline functions interact with coroutines.

u/Anisim_1Kotlin teamin r/Kotlin • Recommends

Kotlin Standard Library functions like map, filter, and repeat allow you to call `suspend` functions in the lambda parameter, but nothing in their signature indicates suspension. How do they do it? 🕵️ Sebastian has the answer: It’s all about inlining.