Everything you need to know about Kotlin 2.0 🟣

preview_player
Показать описание
🏆 My Online Courses

📝 Writing on Medium

☕ Let's get a coffee. You're paying! :)

💻 Github

📸 Instagram

⌚Timestamps
0:00 - Introduction
0:24 - Extensible data arguments
2:28 - Guarded condition
3:10 - Context-sensitive resolution
3:35 - Destructing declaration
4:29 - Explicit backing fields
6:27 - String templates/Triple-quoted String
6:59 - Union Types (Error)
8:00 - Smartcasts
9:45 - Simpler Kotlin Constructs
Рекомендации по теме
Комментарии
Автор

Most of the new language features you showed were previews of changes that are potentially coming in future versions. They are not available in 2.0.

Cypressious
Автор

Kotlin having error types before C# is crazy. Can't wait for real C# Unions.

WDGKuurama
Автор

Do these new union types for errors open the door to explicit errors/errors as values instead of using `throw`?

stijndcl
Автор

hope we'll have union & intersection types everywhere one day

guai
Автор

3:37 fyi the correct term is "destructuring" not destructing. Destructing an object usually refers to freeing its memory, what we are doing here is very different. On the other note a lot of cool features especially better smartcast

mahiainti
Автор

i didnt even know there is kotlin 2.0
thanks man

futsuchinpo
Автор

awesome content Stefan... are you going to update your Kotlin masterclass course with this subject?

DARKcarlos
Автор

1:47 I can't find dataarg!! even kotlin playground 2.0.0 not compiling !! How to use?

shahriarzaman
Автор

I'm getting "Explicit backing fields are not supported in FE 1.0" when I try the live data example you gave?

Here's what Gemni says:
In Kotlin 2.0.0, backing fields are not supported in the frontend (FE) 1.0. This means that you cannot access or modify the backing field of a property directly.
There are a few reasons for this change. First, backing fields are not necessary in Kotlin. The compiler automatically generates getters and setters for properties, so you don't need to worry about creating them yourself. Second, backing fields can be a source of bugs. If you accidentally modify the backing field directly, you can easily break your code.

jtsdeals
Автор

i cant find any documentation about union types??

juanherrera
Автор

Wow these are great additions!
I've never encountered the type issues fixed however.

I didn't really get the extensible data arguments tho, I'll have to look into it more. It makes me wonder if it means passing an object as argument instead of having real function arguments, therefore what would be the performance drawbacks (GC pressure)

supercurioTube
Автор

Hey @Stevdza-San,
I have migrated my project to Kotlin 2.0, how I can use the BackingFields now, when I'm trying to use it, I got this error: Explicit backing field declarations are not supported in FE 1.0

Ezraelk
Автор

I think the best addition is regarding livedata

abdkak
Автор

I can't find any info on these error objects (6:59). Is it documented or announced somewhere? Could this be only a part of the internal API?

vibovitold
Автор

Is the dataarg close to a trait in a php class?

DamjanDimitrioski
Автор

I updated my kotlin version on 2.0.0 and the Android Studio still doen't know what dataarg keyword is. Does someone else experience the same? Thanks

markdelphi
Автор

wowww K2 is amazing, I hope my laptop can run new android studio version + emulator.

maousama
Автор

Good choice on taking the goods from C#

randypenajimenez
Автор

It's not "destructing", it's "destructuring". And triple quote strings are called "raw strings".
Overall the changes seem rather underwhelming, there's no new features to functional programming for example (Kotlin's strongest point).

Anonymous-jbxx
Автор

please guide us to learn some topics like Notification channels, work managers and foreground services, please sir its a request

ayushrai