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!
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.
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!
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?
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!
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!)
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!
@@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.
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!
I do not know how you do it Dave but you explain everything so clear. I guess its what they call a teaching talent!
Haha, thanks so much, Mike! I do enjoy the challenge!
I loved this episode! Always had trouble with the nomenclature. Using a non-generic example is really helpful, thank you!
Thanks so much, Jentaro! Yes, some of the concepts seem a bit counterintuitive at first, but I'm glad this was helpful!
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.
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.
Thank you so much! I'm especially happy to hear that it's helpful for someone who doesn't natively speak English!
Best explanation on this topic I've seen. Great work!
Hey, wow! Thank you so much!
That is why they say teaching is an art, and how beautifully you share this art
Wow, that's very kind of you to say! Thank you so much!
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.
Thank you so much, Asadullah! I'm glad you liked it. I'll keep at it!
Your online book and videos are great and useful. Cannot recommend enough. Thank you sir!
Thank you so much - I'm so glad you've found them useful!
One of the best explanations of variance I have seen/read! Thanks!
You're most welcome! I'm glad you liked it!
Thank you so much! Clean explanation and straight to the point. Please continue uploading videos
Thanks so much! I'll keep at it!
This is so awesome that you explain in the most simple way. Thank you in advance 🙏
You're most welcome! I'm glad you enjoyed it!
Bro , the way you explained thus was flawless. Thanks
Haha, thank you! I'm glad you liked it!
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!
Thank you so much! I'm so glad to hear that you've enjoyed the videos and book! I'll keep at it! 👍
Great ! Very comprehensive, thank you for your effort.
You're most welcome!
Thank you for your video. I had misunderstood before watching your video that variance was only relevant to generics, but that was incorrect.
You're most welcome! I'm glad you found it helpful!
I never completely know in and out keywords, Now I totally get it, well don
Thank you so much! I'm glad you found it helpful!
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!
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!
Man, your explanation is great!
Thanks so much, Darwin! I'm glad you liked it!
amazing work, you don't even know how much I apprecaite your content!
Thank you so much! I'm so glad to hear you've enjoyed it!
Very nice, high quality, video! Thanks!
You're most welcome! I'm glad you liked it!
OMG! Today I understand a bit about covariance and contravariance. Thank you so much.
I'm so glad it was helpful! And you're most welcome!
Very well explained !!!
You're very good at this 👏
Hey, thank you so much!
Talent in Teaching ✅
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'.
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?
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!
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!)
Great content, thanks!
You're most welcome! I'm glad you liked it!
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.
I will try to watch the entire video 3-4 times and write notes on it to better understand it.
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!
@@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.