31 ms·
I don’t really want to wade into the Rust vs other languages thing, but I would be curious for Elementary’s take on why Vala over Rust (gtk-rs seems to see wide
by Klonoar 4y ago
I don’t really want to wade into the Rust vs other languages thing, but I would be curious for Elementary’s take on why Vala over Rust (gtk-rs seems to see widespread use and all).
Anyone know if they’ve noted it somewhere? Is it just the investment in Vala and their custom widget library that set the direction?
- berkut 4y agoWell, for a start, that blog post was written one year before Rust 1.0 was released.
- cyber_kinetist 4y agoA counterpoint: Vala hasn't done a 1.0 release yet. But still, back at that time (2014) there was far less research done on how Rust library authors can ergonomic bind to C/C++ libraries that have their own object system. Nowadays people have figured out some techniques and we can actually use GTK and Qt from Rust, albeit in an awkward manner (lots and lots of macros).
- agumonkey 4y agoIt seems the benefits of vala were so large that not having a proper version one was not a problem.
- bonzini 4y agoVala had made up its mind for many years on what it looks like and feels like. Older Rust version had green threads and IIRC even a garbage collector, it was absolutely not the same language as Rust 1.0.
- Klonoar 4y agoHa! You're totally right. I read this on mobile and I don't think the title had (2014) in it when I did, completely overlooked it.
- cyber_kinetist 4y agoElementary is heavily dependent on the GTK ecosystem, which has its own OOP system implemented in C (for example like GObject). It is really hard to map GTK's OOP semantics to Rust. People have tried things like https://github.com/gtk-rs/gtk3-rs https://github.com/gtk-rs/gtk3-rs, but it requires heavy macro usage and doesn't feel like ergonomic Rust. On the other hand Vala is directly built upon the GObject system on the first place, so it's more fitting for GTK-specific development.
- PaulDavisThe1st 4y agoUntil barely a couple of years ago, nobody wrote GUI applications in Rust anyway. GTK's OOP semantics have been mapped very successfully to, among other languages, C++, Python, Perl and Go. It's unfortunate perhaps that the Rust bindings do not feel idiomatic for Rust programmers, but that's hardly fatal or unexpected.
- cyber_kinetist 4y agoI think it's just that Rust doesn't have inheritance/subclassing as a feature. As a result you have to do all sorts of mental gymnastics with impls and macros to fit Rust interface on GTK, while with other languages subclassing just "works". I also think this is why Rust has lagged heavily on the GUI development front. No matter how you claim component or ECS-based architectures are better and faster, sometimes the only thing you really need might be a good ol' inheritance-based scenegraph... You can definitely do UI with a component-based object model (ex. Unity game engine), but the whole process seems a bit more... convoluted.
- tragomaskhalos 4y agoWe have moved as an industry from "subclassing works great for GUIs" to "let's use it for absolutely everything else" through to "subclassing is a terrible idea, what were we thinking of?", whereas the first of those ideas is actually still sound.
- captainmuon 4y ago