On 11/03/14 03:59 PM, Clark Gaebel wrote:
> I like virtual functions. They're not for everything, and stylistically,
> traits are almost always a better solution. However, they can be nice to
> reduce code bloat. See how the LLVM devs managed to share a good amount
> of code for their SmallVector class thanks to the magic of virtual
> functions:
> 
> http://llvm.org/docs/doxygen/html/classllvm_1_1SmallVector.html
> 
> Not sure if it deserves a whole keyword, but a way to do this
> efficiently would be nice.
> 
>   - Clark

Traits already provide a choice between monomorphization and virtual
function tables. I hope that the existing system can be extended in an
orthogonal way. I would be very disappointed if Rust ended up like C++,
where you have two almost completely exclusive systems.

I think object inheritance is a very counter-intuitive concept, without
much basis in either the real world or theory. Traits could be extended
to include non-virtual fields, without us having the concept of base
classes.

Existing object systems like COM, DOM and gobject are worth looking at,
but Rust shouldn't bend over backwards to support them. They're legacy
technologies and while interacting with them is important, I don't think
it should result in any extra complexity being added to Rust.

Attachment: signature.asc
Description: OpenPGP digital signature

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

Reply via email to