Hacker News new | ask | show | jobs
by DougBTX 1658 days ago
There isn't a massive difference between type instability vs programming against interfaces in OOP languages or using a Box<dyn T> in Rust, both add an extra indirection which has a performance impact, but depending on the situation it could be a positive or negative impact.
1 comments

it has a huge impact on static analysis to know that the type is a Box<dyn T> in rust, and you can't (without something else) downcast Box<dyn T> to a specific U.

i don't care about the performance as much the correctness :)