Hacker News new | ask | show | jobs
by iTokio 5 days ago
That’s a good point.

Usually when people say to prefer composition over inheritance, that does not apply to the inheritance found in GUI, but as an alternative way to share behaviors as a property, « has a » instead of « is a », like has a role instead of being a user, admin..

That do not work well with GUI, where hundreds of of components are reusing common containers, widget behavior, it would be very verbose and painful to always declare common behaviors, data.

I think, React is cheating because it’s based on the web which already provide DOM node components and JavaScript, a GC language where most rust issues do not apply, there is already an underlying composition framework, the problem is that it is not easy to reproduce in rust.

1 comments

It does on COM, but FOSS tends to disregard learnings from commercial platforms.

See VB 5 and 6 (when VBX got replaced by COM), and anything WinRT, UWP, WinUI.

The work Microsoft has been doing on windows-rs translates quite good into Rust, unfortunately the team doesn't like using designers.