15 Free YouTube subscribers for your channel
Get Free YouTube Subscribers, Views and Likes

Two Ways To Do Dynamic Dispatch

Follow
Logan Smith

Rust and C++ both have builtin (but differentflavored) support for dynamic dispatch, and both also let you open the hood and implement it the other way that's not builtin. 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 rerecording the live coding section like 5 times because I kept messing it up.

the Sean Parent talk    • Better Code: Runtime Polymorphism  S...  
godbolt to the demo https://rust.godbolt.org/z/6YrK3vhGj

dyno https://github.com/ldionne/dyno
NonNull https://doc.rustlang.org/stable/std/...
thunk https://en.wikipedia.org/wiki/Thunk
std::function https://en.cppreference.com/w/cpp/uti...
std::any https://en.cppreference.com/w/cpp/uti...

I use the amazing Manim library for animating these videos, and I edit them with Blender and Audacity.
https://www.manim.community/
https://www.blender.org/
https://www.audacityteam.org/

posted by electryas