On 3/12/14 7:16 AM, Bill Myers wrote:
However, the extensibility of trait objects comes at the cost of fat
pointers, which can be a problem if you have a lot of pointers.

This is fixable without introducing virtual functions, by adding a
way to express "Struct and vtable for impl Trait for Struct" and
"thin pointer to Struct and vtable for impl Trait for Struct" (or by
using an indirect pointer, i.e. ~~Trait or Rc<~Trait>).

I don't understand the first option--isn't that basically "virtual struct"? The second has overhead even worse than the fat pointer: two allocations.

Patrick

_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to