Two Ways To Do Dynamic Dispatch

preview_player
Показать описание
Rust and C++ both have built-in (but different-flavored) support for dynamic dispatch, and both also let you open the hood and implement it the other way that's not built-in. In this one we look at both languages' approaches, weigh the pros and cons, and ultimately come away seeing that they're both the right choice in different situations (isn't that just so unsatisfying and typical).

Special guest appearances from vtables, vptrs, wide pointers, thunks, unsafe code, drop glue, virtual destructors, the Rule of Three, and me re-recording the live coding section like 5 times because I kept messing it up.

I use the amazing Manim library for animating these videos, and I edit them with Blender and Audacity.
Рекомендации по теме
Комментарии
Автор

Inside of you there are two wolves: One that cannot wait for new Logan Smith content, and one that knows it must wait for quality videos. The wolves are lovers. Woof woof.

natashavartanian
Автор

You did, in fact, blow my mind with static promotion 🤯

jm-alan
Автор

Rust is the only piece of tech I've used extensively that I continue to be MORE impressed with over time. Usually the cupcake-phase wears off and you start disliking the warts found in all technology, but somehow after years of using Rust, I love it even more than the day I first picked it up. Fantastic video, thank you for starting a channel geared towards experienced engineers, there are very few of them.

AlecThilenius
Автор

Watching the metrics of this channel since it started putting out Rust content has been fun.

You should upload a video on April 1st that explains how to do something in Rust the game, but explain it as if you are explaining some technical topic about Rust the programming language.

kinositajona
Автор

Incredible stuff you are putting out.
For me, there isn't much new information, but you always manage to present a slightly different way of looking at things, which has so far always been valuable.
Your animations are spot on as well and make your videos an excellent resource that I'm eager to pass on.
Keep it up!

JaconSamsta
Автор

It was so cool seeing you implement vtables manually! It's something I have been curious about and always wanted to see someone do. Learned a lot too! Good stuff 😄

BlackMsh
Автор

Not gonna lie, I said out loud "wait, what?!!" when I saw you invoke &SpeakFunctions as 'static. That's certainly something new to me, and I love it (obviously, only for extremely specific circumstances).

quilan
Автор

I code in C++ most of the time. I could do the first approach similarly in C++ (with similarly large amounts of boilerplate), but the &dyn trait type is the kind of compiler magic that I'm envious of from Rust: I wish we had dynamic dispatch in C++ that doesn't entangle the implementation and the trait/interface/concept.

szaszm_
Автор

19:40 I like that last quote

class Inheritance { }
class Evil : Inheritance { }

antonpieper
Автор

your explanations are SO clear and understandable!! I don't have any formal comp-sci education, the only strong-typed lang I've only worked in was Go for a year, and _all_ of this is making sense to me – your presentation skills are immense 🤩

henrahmagix
Автор

I really hope you'll continue making your Rust explainers. They are, bar none, the best and most insightful videos about Rust on all of YouTube. You put all the other Rust-focused content creators to shame. Please keep making videos!

Keavon
Автор

Man, I love your videos. I rarely ever _learn_ something new, but my understanding of the topic gets so much better.
I was also wondering the entire time if you'd mention anyhow, and I'm glad you did

sapphie
Автор

Very nice explanation, didn't realise this difference until now

basilefff
Автор

Gotta say it's been a long time since I have been this excited about watching a new youtube video.

meanmole
Автор

This is a really fantastic video. Well made, well rehearsed, and well taught. Kudos from a seasoned Rustacean!

benreeves
Автор

amazing explanation, clear and to the juice of the discussion

lesto
Автор

This was great. I hope you make a follow-up video about downcasting(or maybe all types of casting) in Rust vs C++.

martingeorgiev
Автор

Explanation and visuals are absolute class.!!!

Theodorlei
Автор

Very well done! I’ve been hoping you would make a clear and insightful video into this topic. I find your videos to actually provide real explanations for how things work. So many videos out there fail to get to the meat of the matter. Thank you for doing what you do!

carterthaxton
Автор

I am so glad youtube recommended me this!

dogik