3 ms·
> Rust is great and all, but every time I play with it I just don't see how it would work well with the complex inheritance tree that is a widget toolkit I hav
by eridius 10y ago
> Rust is great and all, but every time I play with it I just don't see how it would work well with the complex inheritance tree that is a widget toolkit
I haven't actually done anything along this route myself, but I think the most promising approach is to model all the widgets as traits (and traits can depend on other traits, which lets you model the inheritance tree).
- the_duke 10y agoThe problems lie both in the lack of field inheritance (something talked about in Rust as "virtual structs") and the difficulties with modeling a bi-directional tree structure with the borrow checker.
- eridius 10y agoFor the bi-directional tree structure, it seems to me you could use Rc<Widget> for the children and rc::Weak<Widget> for the parent field.