Variance... without Generics!

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

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

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

    Big thanks to the folks who joined the premiere and said hello in chat! Maybe we can do that again next time. I'm also considering whether an occasional livestream would be helpful, where I might be able to respond to chat questions and comments in video instead of text. Anyway, if you've got thoughts about any of that, let me know!

  • @Mike-er2ih
    @Mike-er2ih 6 หลายเดือนก่อน +26

    I do not know how you do it Dave but you explain everything so clear. I guess its what they call a teaching talent!

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

      Haha, thanks so much, Mike! I do enjoy the challenge!

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

    I loved this episode! Always had trouble with the nomenclature. Using a non-generic example is really helpful, thank you!

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

      Thanks so much, Jentaro! Yes, some of the concepts seem a bit counterintuitive at first, but I'm glad this was helpful!

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

    It takes a very deep understanding of a subject and a creative mind to bring such simplicity to a somewhat complex concept, in a lucid manner.
    Thank you.

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

    Thanks youtube for recommend this channel. It definitely deserve more views! You teach as clear as day, even though I'm not a native english speaker. Thanks for sharing your knowledge.

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

      Thank you so much! I'm especially happy to hear that it's helpful for someone who doesn't natively speak English!

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

    Best explanation on this topic I've seen. Great work!

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

      Hey, wow! Thank you so much!

  • @mohammad-rezaei2018
    @mohammad-rezaei2018 2 หลายเดือนก่อน

    That is why they say teaching is an art, and how beautifully you share this art

    • @typealias
      @typealias  2 หลายเดือนก่อน +1

      Wow, that's very kind of you to say! Thank you so much!

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

    This is one of the brilliant videos on TH-cam. Mind blowing explanation. Thank you Dave. You are doing an excellent job. Keep it up.

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

      Thank you so much, Asadullah! I'm glad you liked it. I'll keep at it!

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

    Your online book and videos are great and useful. Cannot recommend enough. Thank you sir!

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

      Thank you so much - I'm so glad you've found them useful!

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

    One of the best explanations of variance I have seen/read! Thanks!

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

      You're most welcome! I'm glad you liked it!

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

    Thank you so much! Clean explanation and straight to the point. Please continue uploading videos

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

      Thanks so much! I'll keep at it!

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

    This is so awesome that you explain in the most simple way. Thank you in advance 🙏

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

      You're most welcome! I'm glad you enjoyed it!

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

    Bro , the way you explained thus was flawless. Thanks

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

      Haha, thank you! I'm glad you liked it!

  • @user-ig1ty7dl1k
    @user-ig1ty7dl1k 4 หลายเดือนก่อน

    This is the best explanation I ever heard! Please dont stop doing your lessons. Also want to say thank you for your book, this is really perfect!

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

      Thank you so much! I'm so glad to hear that you've enjoyed the videos and book! I'll keep at it! 👍

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

    Great ! Very comprehensive, thank you for your effort.

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

      You're most welcome!

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

    Thank you for your video. I had misunderstood before watching your video that variance was only relevant to generics, but that was incorrect.

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

      You're most welcome! I'm glad you found it helpful!

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

    I never completely know in and out keywords, Now I totally get it, well don

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

      Thank you so much! I'm glad you found it helpful!

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

    I love your videos! I’m always struggling to understand and retain in my brain these to concepts, and this one will help a lot!

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

      Antonio! Thanks so much! Yes, variance can certainly seem counterintuitive, so I've often had to think twice about it, too. Glad you enjoyed the video!

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

    Man, your explanation is great!

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

      Thanks so much, Darwin! I'm glad you liked it!

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

    amazing work, you don't even know how much I apprecaite your content!

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

      Thank you so much! I'm so glad to hear you've enjoyed it!

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

    Very nice, high quality, video! Thanks!

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

      You're most welcome! I'm glad you liked it!

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

    OMG! Today I understand a bit about covariance and contravariance. Thank you so much.

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

      I'm so glad it was helpful! And you're most welcome!

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

    Very well explained !!!

  • @lp1926.guitars
    @lp1926.guitars 5 หลายเดือนก่อน

    You're very good at this 👏

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

      Hey, thank you so much!

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

    Talent in Teaching ✅

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

    Great video, but I'd like to know a bit more about why params should be contravariant and why that isn't considered 'breaking the contract'.

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

      Hey Mike, sure thing!
      Let's say you've got a birthday card that you want to send to your friend. You need to find an envelope receptacle to mail it (i.e., a collection box that accepts envelopes). In this case, the contract you need is that _the receptacle must accept an envelope_. A thin mail slot at an apartment complex would meet your needs - it fulfills the contract, because it accepts an envelope.
      Now, if you were to go to the post office, they might have a receptacle that's big enough to receive either an envelope _or_ a box package - any kind of mail. That receptacle would _also_ meet your needs, because it still accepts an envelope. Sure, it also happens to accept packages, but that fact is irrelevant to your situation - as long as it accepts an envelope, it meets the contract.
      Similarly, in Kotlin, you could assign the post office mail receptacle to a variable that's declared as an envelope receptacle, because it can still accept envelopes.
      ---
      interface Mail
      interface Envelope : Mail
      interface Package : Mail
      val mailSlot: (Envelope) -> Unit = { /* ... */ }
      val postOffice: (Mail) -> Unit = { /* ... */ }
      var envelopeReceptacle: (Envelope) -> Unit
      envelopeReceptacle = mailSlot // OK - accepts envelopes
      envelopeReceptacle = postOffice // OK - also still accepts envelopes
      ---
      Does that example help to clarify it better?

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

      Thanks @@typealias , I understand the examples but it's also easy to think up examples where this doesn't make sense. You could change the parameter type in the implementation to "Any". Very useful video though - many thanks!

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

      Okay, thanks Mike! If you want, feel free to direct-message me on X or LinkedIn, and I can send you early access to Chapter 19, and see if you still have unanswered questions after reading it. (I'm sure if you'd have some questions, other people would, too!)

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

    Great content, thanks!

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

      You're most welcome! I'm glad you liked it!

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

    Now I am more confused, but some level of knowledge is acquired. Maybe we need some kind of mnemonics with images to understand it more.

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

      I will try to watch the entire video 3-4 times and write notes on it to better understand it.

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

      Wow, watching the video multiple times and taking notes - that's dedication! 👏 The concepts in this video might make more sense for you when chapter 19 comes out, so if it's still not connecting for you after a few times through, don't worry too much!

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

      @@typealias Took 4 more times to rewatch the entire video and understood a lot!
      Understanding Variance without generics did help to understand how Variance with Generics works!
      Very nicely explained! Thanks.