u/Tubthumper8in r/rust • Recommends
On “Why do unnamable types exists in rust?”
51K subscribers • 6 videos on Hallway
Intermediate. Assumes working knowledge.
226K views3 years ago4 recommendations
Programming languagesSystems programmingRustC++Compilers and interpreters
Logan Smith explains how Rust handles function types and closures, comparing its zero-overhead generic codegen to C++.
Rust takes a unique approach to function types, for both closures and fn items. In this video we'll talk about a way to fit these strange function types into your existing understanding of what types are. Then we'll look at how another language (okay, it's C++) does function types in a way that causes poor codegen in generic higher-order functions if you aren't careful--and how/why Rust avoids this problem. Compiler Explorer - godbolt.org/ Godbolt code samples from the video: C++ - godbolt.org/z/xo83Ecfqb Rust - rust.godbolt.org/z/E5fvaxWPM *Rust Stuff* fn pointers vs. fn items - doc.rust-lang.org/std/primitive.fn.html#creating-function-po… Fn (the trait) - doc.rust-lang.org/std/ops/trait.Fn.html *C++ Stuff* Decay - en.cppreference.com/w/cpp/types/decay Boost.TypeIndex - boost.org/doc/libs/1_82_0/doc/html/boost_typeindex.html std::reduce - en.cppreference.com/w/cpp/algorithm/reduce Ranges - en.cppreference.com/w/cpp/ranges static - en.cppreference.com/w/cpp/language/storage_duration I use the amazing Manim library for animating these videos, and I edit them with Blender and Audacity. manim.community/ blender.org/ audacityteam.org/What people say. Recommended for its clear explanation of why Rust functions have unique unnamable types and how they optimize performance.
u/Tubthumper8in r/rust • Recommends
On “Why do unnamable types exists in rust?”
u/bayovakin r/rust • Recommends
On “I met someone today who's first language was rust. They are doing a degree, but it seems before this they just sat down and learned to program and chose rust because of its popularity. I am very jealous.”
u/shader301202in r/rust • Recommends
On “Is using lots of function pointers bad for performance?”
u/TrinitronXin r/rust • Recommends
On “What would you present to C++ developers interested in Rust?”