3 ms·
> A vec where every item is independently heap allocated? Just because that's the example given (by someone who's trying to understand the concept, no less) do
by filleduchaos 2y ago
> A vec where every item is independently heap allocated?
Just because that's the example given (by someone who's trying to understand the concept, no less) doesn't mean that that's the only thing that the language feature is usable for.
Trait objects (read: runtime polymorphism) have their pros and cons just as generics (read: parametric polymorphism) have theirs. Not everything can be known at compile time, and that's perfectly okay.