2023 Jan 14
Difference between
implanddyn: they call it static vs. dynamic dispatch. Static dispatch is that the rust compiler will copy code for each type that fits theimpltype. Dynamic dispatch is that it will store a fat pointer to both the object and vtable of functions, i.e. it has to deference two pointers to call a function at runtime.Most of the time wouldn’t you just want to use
impl? Seems like adding extra code in compile time wouldn’t be that big of a deal.- Adding to this a week later: An example: let’s say you want to return different error types from a function. You couldn’t just do
implbecause you couldn’t statically dispatch, i.e. you couldn’t just make two different functions for each type because the returned type is determined at runtime.
- Adding to this a week later: An example: let’s say you want to return different error types from a function. You couldn’t just do
What about
Box<dyn Error>? I see that used often. Why?
Helix. On one hand it’s sort of a distraction from the main work, but it’s also fun to learn something new. I think it could help while getting assimilated to rust-lightning if I knew how to navigate code easier. I could probably just get better at VS Code, but whatever.
Along the same lines of using a terminal-based editor, going to actually commit to customizing my terminal setup, iTerm, or at least try it.
Already realizing how much better iTerm is after just tweaking a few things. Also went through Helix tutor and it’s pretty interesting, and I get how a lot of things are intuitive like the guy in the video said.
Spent way too much time deciding between themes for helix lol.