Everything you need to know about Kotlin 2.0 🟣

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 พ.ย. 2024

ความคิดเห็น • 113

  • @joshdoesitall
    @joshdoesitall 6 หลายเดือนก่อน +284

    Kotlin 2 before GTA6 is crazy

    • @curizic
      @curizic 6 หลายเดือนก่อน +33

      I suspect there will be Kotlin 3 before GTA 6

    • @gregandark8571
      @gregandark8571 3 หลายเดือนก่อน +1

      @@curizic Maybe even Kotlin 4.0 before GTA 6.

  • @Cypressious
    @Cypressious 5 หลายเดือนก่อน +49

    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.

    •  5 หลายเดือนก่อน +3

      Indeed, most of these were not mentioned in the release notes. We already moved our Android project to K2 and if the destructuring expressions really worked like that, our code wouldn't have compiled in the first place, but we saw none of that.

    • @patrykkowalski8355
      @patrykkowalski8355 5 หลายเดือนก่อน +5

      true, seems like typical click bait

  • @jackeblan
    @jackeblan 6 หลายเดือนก่อน +49

    I love the backing field😮

    • @Henderson101
      @Henderson101 6 หลายเดือนก่อน +2

      Coming from C#, this is kind of like a readonly property:
      private sting x; //is mutable
      public string X => x; // is immutable
      (or you can do, which makes an implicit private backing field int he generated IL, but in your code, you just use X)
      public X {get; private set;}
      (Or if you like old school)
      private string x;
      public string X
      {
      get => x;
      private set => x = value;
      }

  • @mahiainti678
    @mahiainti678 5 หลายเดือนก่อน +3

    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

  • @guai9632
    @guai9632 5 หลายเดือนก่อน +3

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

  • @universe8989
    @universe8989 6 หลายเดือนก่อน +4

    Loved the guarded condition!

  • @Anonymous-jb7xx
    @Anonymous-jb7xx 5 หลายเดือนก่อน +2

    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).

  • @stijndcl
    @stijndcl 6 หลายเดือนก่อน +5

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

  • @WDGKuurama
    @WDGKuurama 5 หลายเดือนก่อน +21

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

    • @this-is-bioman
      @this-is-bioman 5 หลายเดือนก่อน

      Kotlin is already lightyears ahead of C# and remember my words... it'll compile to .net some day 😁

    • @thmo_
      @thmo_ 5 หลายเดือนก่อน +6

      Kotlin is fairly younger I think, Microsoft has to worry about lots of compatibility things to introduce features like that.
      Take a look at the latest breaking changes in C#13; accessing the backing field in auto properties was held back for nearly two years just because the keyword „field“ might break existing code and needs to be refactored. So I guess Microsoft is dealing with other issues than Jetbrains is adding new language features.

  • @MaggicBones
    @MaggicBones 6 หลายเดือนก่อน +6

    Thank you so much Stev !

  • @TerenceKearns
    @TerenceKearns หลายเดือนก่อน

    When will your Kotlin masterclass be v2?

  • @jtsdeals
    @jtsdeals 6 หลายเดือนก่อน

    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.

  • @vibovitold
    @vibovitold 6 หลายเดือนก่อน +2

    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?

    • @StevdzaSan
      @StevdzaSan  6 หลายเดือนก่อน +1

      They are yet to be released, they just announced it on a Kotlin conf. You can watch the video from the conference itself, google it.

    • @vibovitold
      @vibovitold 6 หลายเดือนก่อน

      @@StevdzaSan got it! Thanks

  • @jam4l
    @jam4l 6 หลายเดือนก่อน +4

    Great summary, thanks.

  • @DARKcarlos1
    @DARKcarlos1 6 หลายเดือนก่อน +2

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

    • @StevdzaSan
      @StevdzaSan  6 หลายเดือนก่อน +1

      Yep I'll add a few new lectures in the following period.

  • @futsuchinpo9892
    @futsuchinpo9892 6 หลายเดือนก่อน +1

    i didnt even know there is kotlin 2.0
    thanks man

  • @Ezrael2k5
    @Ezrael2k5 6 หลายเดือนก่อน +1

    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

    • @StevdzaSan
      @StevdzaSan  6 หลายเดือนก่อน

      Kotlin 2.0(RC1) introduced explicit backing fields as far as I know.

  • @Noor_alden
    @Noor_alden 6 หลายเดือนก่อน +3

    thank u for the great content ❤

  • @pakkerto
    @pakkerto 3 หลายเดือนก่อน

    why multiplatform kotlin template error when android studio is set to kotlin 2.0?

  • @rhen4610
    @rhen4610 6 หลายเดือนก่อน

    Loveee the backing field update

  • @vadimn6393
    @vadimn6393 3 หลายเดือนก่อน

    when i wrote:
    dataarg class Config (val Arg1: Int = 1)
    i get the error:
    Syntax error: Expecting a top level declaration
    (without dataarg - all ok)
    IntelliJ IDEA 2024.2
    Kotlin compiler version: 1.9.25
    Language version: 2.0

  • @supercurioTube
    @supercurioTube 6 หลายเดือนก่อน +1

    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)

    • @vibovitold
      @vibovitold 6 หลายเดือนก่อน +1

      It should have been rather easy to implement it as a zero cost abstraction (similar to value classes or inline functions). The best way to find out - other than by looking up the docs - is decompiling the bytecode to Java to see how it's resolved under the hood... (I like doing it that way because it's more instructive)

    • @supercurioTube
      @supercurioTube 6 หลายเดือนก่อน

      @@vibovitold good point, I hope so too.
      In a way it is almost odd that this new concept is a "class" but I guess it avoids introducing a completely new thing in the language and its tooling.

  • @randypenajimenez3893
    @randypenajimenez3893 6 หลายเดือนก่อน +5

    Good choice on taking the goods from C#

    • @EmanNollase
      @EmanNollase 6 หลายเดือนก่อน

      ..also from Swift

  • @rodrigob
    @rodrigob 5 หลายเดือนก่อน +2

    Nice summary! Thanks for the video. A small english correction, "more cleaner" is considered a grammatical error. One should simply say "cleaner" or maybe "even cleaner".

  • @esquilo_atomico
    @esquilo_atomico 6 หลายเดือนก่อน +1

    love smartcasts

  • @DamjanDimitrioski
    @DamjanDimitrioski 5 หลายเดือนก่อน

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

  • @abdkak4119
    @abdkak4119 6 หลายเดือนก่อน

    I think the best addition is regarding livedata

  • @juanherrera9521
    @juanherrera9521 6 หลายเดือนก่อน

    i cant find any documentation about union types??

  • @ashwin_mahajan
    @ashwin_mahajan 6 หลายเดือนก่อน

    Thanks for the video, san

  • @bO-sb7el
    @bO-sb7el 5 หลายเดือนก่อน

    where is static extensions? ((

  • @vengateshm2122
    @vengateshm2122 6 หลายเดือนก่อน +1

    Well compiled video.

  • @maousama168
    @maousama168 6 หลายเดือนก่อน

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

  • @forresthopkinsa
    @forresthopkinsa 5 หลายเดือนก่อน

    Destructuring YEEEAAAAAA

  • @shahriarzaman4715
    @shahriarzaman4715 5 หลายเดือนก่อน

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

    • @sharukhmohammed3377
      @sharukhmohammed3377 3 หลายเดือนก่อน

      It comes with Kotlin 2.1 or 2.2 as beta

  • @xitize
    @xitize หลายเดือนก่อน

    Thanks 👍

  • @Virus00000000000001
    @Virus00000000000001 5 หลายเดือนก่อน

    Thats huge stuff. Thanks

  • @techxyz5475
    @techxyz5475 6 หลายเดือนก่อน +1

    Major Change

  • @ayushrai3266
    @ayushrai3266 5 หลายเดือนก่อน

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

    • @StevdzaSan
      @StevdzaSan  5 หลายเดือนก่อน

      I already have a tutorial series about Notifications and Work Manager. Also you can check my Stopwatch tutorial to learn more about Foreground service.

    • @ayushrai3266
      @ayushrai3266 5 หลายเดือนก่อน

      Ok sir Thanks ❤
      Btw your tutorial of remote Mediator+ pagination is well explained ❤(That Boruto App With Ktor backend Course on udemy )

  • @haseeb776
    @haseeb776 3 หลายเดือนก่อน

    I want to uplift my career as native android developer. I have beginner level expertise over 1.5 year. Please suggest any relevant certification that may help me to grow in market.

    • @StevdzaSan
      @StevdzaSan  3 หลายเดือนก่อน

      @@haseeb776 Send me a message on Instagram.

  • @aa3352-m9w
    @aa3352-m9w 4 หลายเดือนก่อน

    Thanks

  • @LokendraBohara-s3u
    @LokendraBohara-s3u 6 หลายเดือนก่อน

    how to use dataarg class ?

  • @thirstypooch
    @thirstypooch 5 หลายเดือนก่อน

    thanks for this

  • @VinyJones2
    @VinyJones2 5 หลายเดือนก่อน

    🤩

  • @lover1301
    @lover1301 2 หลายเดือนก่อน

    Prepare for the language of the future.

  • @krtirtho
    @krtirtho 5 หลายเดือนก่อน +1

    dataarg❌
    Dat aarg✅

  • @gorudonu
    @gorudonu 6 หลายเดือนก่อน +5

    this is what I needed, more keywords and making language more complicated /s

    • @StevdzaSan
      @StevdzaSan  6 หลายเดือนก่อน

      No worries, buddy, I'll simplify it for you when the time comes 😎🙌

    • @vibovitold
      @vibovitold 6 หลายเดือนก่อน +1

      Nobody forces you to use them, or even to upgrade to 2.0.
      Besides, a lot of these changes actually simplify things (such as more intuitive smart casting).

  • @devatrii
    @devatrii 6 หลายเดือนก่อน

    ❤❤

  • @techxyz5475
    @techxyz5475 6 หลายเดือนก่อน

    👌

  • @allanandliftedhands2669
    @allanandliftedhands2669 6 หลายเดือนก่อน

    Kotlin all the way

  • @sorousheskandary-l7q
    @sorousheskandary-l7q 24 วันที่ผ่านมา

    Hi, There a lot of countries that aren't connect to global banking system, It'll be nice if you put your crypto wallet address for those donations

  • @johnathanrhoades7751
    @johnathanrhoades7751 5 หลายเดือนก่อน

    I want dataargs in all my oop languages

  • @this-is-bioman
    @this-is-bioman 5 หลายเดือนก่อน

    The new destructing constraint is insane! Why would they do this? I hope they'll loosen it soon enough.

    • @khanhuynh.social
      @khanhuynh.social 5 หลายเดือนก่อน +1

      i have same consideration with you, cause after migrate to 2.0, we may get error compilcation.

  • @khumokwezimashapa2245
    @khumokwezimashapa2245 6 หลายเดือนก่อน

    GOATlin 🗣🗣🗣

  • @bananasba
    @bananasba 5 หลายเดือนก่อน

    feels like C# clone

    • @desertfish74
      @desertfish74 5 หลายเดือนก่อน

      It’s the other way around really, c# is hastily adopting all sorts of syntax from more modern languages

    • @FilipCordas
      @FilipCordas 5 หลายเดือนก่อน

      @@desertfish74 C# is stealing from f# Kotlin is stealing from c# it's a circle of life.

  • @ayushverma2166
    @ayushverma2166 6 หลายเดือนก่อน

    #1

  • @Daniel_Zhu_a6f
    @Daniel_Zhu_a6f 5 หลายเดือนก่อน

    i'd say, none of these features are actually useful. wasn't it their selling point that you can write modern procedural code, while maintaining full java compatibility? shouldn't they be cutting off oop capabilities, not adding new weird stuff? (i really don't get what prevented people from doing "dataargs" before v2.0, this trick has existed since structs were invented)

  • @letmebe_pro
    @letmebe_pro 6 หลายเดือนก่อน +9

    Every new upgrade - > Kotlin less intuituve/readable. Java is easier in syntax

    • @StevdzaSan
      @StevdzaSan  6 หลายเดือนก่อน +1

      Why do you think that?

    • @letmebe_pro
      @letmebe_pro 5 หลายเดือนก่อน +5

      @@StevdzaSan You can do so many things in one line of code in Kotlin, but... If you read such code, you must do a lot of effort to understand a sense of this oneliner. I think in this matter Java is more readable although you often must write more lines of code.

    • @StevdzaSan
      @StevdzaSan  5 หลายเดือนก่อน +1

      @letmebe_pro I don't think that Kotlin is less readable. However, you do need to learn its syntax to properly understand it. But once you do, it's a whole different story 🚀

    • @DielsonSales
      @DielsonSales 5 หลายเดือนก่อน +2

      I think the point is the more clutter is added to a language, the harder it becomes for beginners to learn it. This seems to be a common complaint nowadays with languages such as Kotlin, Swift and Rust. I guess the problem is at what point do we say it’s “enough”? This is why we see answers such as Go, which was made to be the exact opposite in terms of complexity, and why some people praise C to this day for being a small enough language despite its drawbacks.

    • @neneodonkor
      @neneodonkor 5 หลายเดือนก่อน

      ​DielsonSales I think they add more features because they see beginners flocking other languages...

  • @revs87
    @revs87 6 หลายเดือนก่อน

    Elvis op, Aligator op and now Butth*le o.

  • @ashwin372
    @ashwin372 6 หลายเดือนก่อน

    isn't kotlin a Java clone

    • @vibovitold
      @vibovitold 6 หลายเดือนก่อน +3

      No, it isn't, although if this video (even if you hadn't known anything about Kotlin before) didn't help you realize that, I doubt any comment will

    • @ibrahimanimasahun9431
      @ibrahimanimasahun9431 6 หลายเดือนก่อน

      lmao! wth

    • @yurowitz
      @yurowitz 5 หลายเดือนก่อน +1

      I wouldnt say clome but its heavily inspired by it and could pretty much replace it anywhere. Its also backward compatible

    • @vibovitold
      @vibovitold 5 หลายเดือนก่อน

      @@yurowitzit's interoperable with Java. not "backwards compatible".
      Java isn't its previous version, it's still under development, they are alternatives of eachother and interoperability works in both directions.
      its syntax is clearly different from Java - much more similar to other more modern languages such as Swift.
      it's a JVM language of course - but so is eg. Scala

  • @csmac3144a
    @csmac3144a 5 หลายเดือนก่อน

    None of this will matter in a few years. Languages only need to be usable by AI code writers, not humans. Humans will become experts at creating requirements and specifications for new systems. Code will be almost entirely generated and tested by AI.

    • @desertfish74
      @desertfish74 5 หลายเดือนก่อน +1

      Lol

    • @zweitekonto9654
      @zweitekonto9654 5 หลายเดือนก่อน

      And who do you think will code this "AI" to code? Oh its humans? Oh damn so we need to learn to programme anyway?

    • @Asgoritolin
      @Asgoritolin 5 หลายเดือนก่อน +2

      You will still need to understand the programming language to debug AI code, you can't be 100% reliant on them.
      Not to mention that the AI learns based on examples. If examples are not provided anymore it will start to stagnate.
      Also, what if I want to program for fun?

    • @csmac3144a
      @csmac3144a 5 หลายเดือนก่อน

      @@Asgoritolin We're using synthetic data to pre-train models already. I've generated millions of lines of code purely through models. We've developed an agentic swarm that uses TDD to create code, UX test frameworks to verify against requirements, etc. It's not yet 100% hands off, but it's just a matter of time. The generated artifacts -- plus some RLHF -- will serve to both train future models and inform test-time inference. Certainly there will be a role for developers, and you definitely can code for fun the same way people are still hacking on Z80 boards today for fun.

    • @Asgoritolin
      @Asgoritolin 5 หลายเดือนก่อน +1

      @@csmac3144a So your plan is to just trust the AI. And when it fails, just debug it with AI?
      Idk man. Being 100% reliant on it is just ridiculous. Someone has to manually supervise it at the end. Not to mention that, even if you create synthetic samples, you still need to know that programming language to make them.
      Remember that programming is in everything and therefore can have direct consecuences on people's lives. No system is 100% reliable and that's where software engineers come in.

  • @timandersen8030
    @timandersen8030 6 หลายเดือนก่อน

    Kotlin is terrible. Swift is better.

    • @tharakhgormaniad9820
      @tharakhgormaniad9820 6 หลายเดือนก่อน +2

      i hope you are joking

    • @henrik908
      @henrik908 6 หลายเดือนก่อน +10

      Source - Trust me bro

    • @randypenajimenez3893
      @randypenajimenez3893 6 หลายเดือนก่อน +2

      Says a guy that has never touch Kotlin

    • @AmirHosseinFZ
      @AmirHosseinFZ 6 หลายเดือนก่อน

      🤡 🤡

    • @vibovitold
      @vibovitold 6 หลายเดือนก่อน +1

      The easy part is behind you - we've got a catchy headline.
      Now it would be a good time to substantiate this claim with some observations and examples. Although I suspect the easy part may be the only part :)