Skip to content
0:00 / 0:00

#kotlincontracts#smartcasts#kotlin

Smart Casts with Kotlin Contracts

Dave Leeds

16K subscribers • 19 videos on Hallway

YouTube
  • Recommended by 1 person: 1 in engineering communities.
  • Presented by Dave Leeds
  • Linked in the descriptionKotlin/KEEP

Intermediate. Assumes working knowledge.

8.6K views3 years ago1 recommendation

Programming languagesKotlinCompilers and interpreters

Dave Leeds explains how to use Kotlin experimental contracts to enable smart-casting of variables in custom functions.

Did you know that Kotlin can smart-cast a variable in response to calling your own functions? Well, today we’re going to use Kotlin's experimental Contracts feature to make that happen! Contracts proposal: github.com/Kotlin/KEEP/blob/master/proposals/kotlin-contract… ✨ New to Kotlin? Start here: typealias.com/start/ ... or pick up the new Leanpub Edition! book.typealias.com/ 🚀 I just launched a new email newsletter! Sign up here: newsletter.typealias.com/

Why it's here

1 person recommends this

What people say. Recommended as a concise explanation of how Kotlin contracts work to enable custom smart casts.

u/TypeProjectionin r/Kotlin • Recommends

Video: Smart Casts with Kotlin Contracts

u/brisko_mkin r/Kotlin • Mentions

On “Result Class with Generic Type for both Success and Failure States”

Give contracts a look [video