<RobertJrdens[m]> "Do you have details on that? I'd..." <- > <@jordens:matrix.org> Do you have details on that? I'd love to understand that.
> I know how trait objects work and how they are implemented but have a hard time imagining why it should be "terrible". From what I've seen when experimenting with casts and trait objects on embedded (in `crosstrait`, `serde-erased` etc) it looked just fine.
> The one bloat case I can see now is trait objects preventing inlining of monomorphizations.
> 
> `source() -> Option<&dyn Error>` is the point of the `Error` trait. Without it (and thus without `dyn`) there is nothing meaningful left.

What others have commented yeah. The vtable itself occupies some space. Also, it prevents never-called functions from being optimized out because they're referenced by the vtable. Also it prevents inlining which prevents many optimizations.

Plus `dyn` is not that great to use in embedded, you can't easily own a `dyn Trait` without alloc. You can't return them either, which is the main appeal of the `Error` trait (returning `Result<T, Box<dyn Error>>`.