JavaByte size15min
Early returns from outer space (in Kotlin)
This talk explains how Kotlin’s ‘inline’ functions enable early returns, breaks, and continues across function boundaries, making constructs like ‘forEach’ as flexible as traditional loops. This feature reduces the need for complex design patterns, resulting in simpler, more readable code.
Alejandro Serrano MenaJetBrains
talkDetail.whenAndWhere
Wednesday, April 1, 16:10-16:25
Zaal 4
talks.roomOccupancytalks.noOccupancyInfo
In most imperative languages, you can 'return' from any point in the body of the function. The same applies for 'break'ing and 'continue'ing a loop. But what if you could do so across functions? This is allowed in Kotlin with 'inline' functions!
In this talk we describe how the 'inline' function mechanism in Kotlin works. This means that we're no longer tied to a handful of language constructs for early returning: a 'forEach' function becomes indistinguishable from a 'for' loop. Several design patterns related to stopping early are no longer needed, leading to much simpler code to write and read.
In this talk we describe how the 'inline' function mechanism in Kotlin works. This means that we're no longer tied to a handful of language constructs for early returning: a 'forEach' function becomes indistinguishable from a 'for' loop. Several design patterns related to stopping early are no longer needed, leading to much simpler code to write and read.
Alejandro Serrano Mena
Alejandro Serrano Mena is a passionate of formal methods and functional programming in software development, especially using Kotlin and Haskell as languages. He works as researcher in the Kotlin Language Evolution team at JetBrains and helps co-maintaining the Arrow library. He enjoys not only using and improving those tools, but also spreading the word: he's written four books targeting different levels, regularly gives talks in conferences and meetups.
For quite some time Alejandro was an academic, working on the area of compilers and type systems for functional languages. His PhD thesis versed over error messages, and he's been involved in efforts like improving GHC's support for impredicativity. This knowledge is put in practice in several open source projects, many of them using metaprogramming techniques or compiler extensions.
For quite some time Alejandro was an academic, working on the area of compilers and type systems for functional languages. His PhD thesis versed over error messages, and he's been involved in efforts like improving GHC's support for impredicativity. This knowledge is put in practice in several open source projects, many of them using metaprogramming techniques or compiler extensions.
talkDetail.shareFeedback
talkDetail.feedbackNotYetAvailable
talkDetail.feedbackAvailableAfterStart
talkDetail.signInRequired
talkDetail.signInToFeedbackDescription
occupancy.title
occupancy.votingNotYetAvailable
occupancy.votingAvailableBeforeStart
talkDetail.signInRequired
occupancy.signInToVoteDescription
comments.speakerNotEnabledComments