119 points · by tempodox · 4y ago · 64 comments
I’m building a video editor [1] (actually rebuilding an app that was originally in Swift) and I’ve been happy to see that the performance is great. I think it feels faster than some of the Qt-based editors I’ve tried. I haven’t noticed JS being the bottleneck - way more often it’s been that I’m doing something sub-optimal on the Rust side.
Tauri still feels early in some aspects, but it’s moving quickly and they’re buttoning things up. I think it’s already a strong contender in the space currently (mostly) owned by Electron.
The simple use-cases like "Window > Box > Label" are easy to get going. The more complex widgets like Stack/Grid/TreeView ... aren't.
This project seems to have the same issue: https://github.com/bodil/vgtk/issues/40
This is made more difficult now GTK4 has removed the Container base class, so there's no longer a unified interface for adding children (although it had caveats in the first place).
I totally get the GTK view that (presumably) specific widgets are more intuitive with specific add/remove APIs (like the grid - one doesn't really "appendChild" to a grid).
It just feels like: if there was a consistent container API comparable to the web's appendChild approach, a vdom/declarative approach would require only a very light wrapper. Without it, I keep coming back to the idea of implementing wrapper widgets that expose that consistent API instead. And that's just not something I want to maintain - effectively duplicating each GTK widget for the purpose of making it fit into a tree model.
It's also a problem of trying to wrap richer functionality (pack_start and pack_end) into a simpler set (append only) of course.
So I don't know exactly what my point is :) Perhaps cautioning the reader that the simplicity of the approach comes with a catch.
Let's not throw out all the work that went into Gtk/Qt but instead embrace it. Bindings/wrappers that are idiomatic in the target language. Maybe including a small state or declarative layer and lean on the framework for rendering, input events, windowing, accessibility, etc.
Another example of this approach is TornadoFX which is a declarative Kotlin DSL on top of JavaFX.
Here’s a good discussion on it: https://internals.rust-lang.org/t/rationale-of-apache-dual-l...
Additionally, there's an added benefit if you're building non-(L)GPL software with it: you can just use the compiler defaults (statically link Relm4, dynamically link Gtk) and stay compliant.
It feels like a lot of code needs to be written, but in my experience that's because it necessitates thinking about the edge cases in a way that you can try to ignore with more imperative UI or data flow.
I've used the Elm paradigm in Elm and in Swift on iOS. Would definitely use it again for any data-driven complex UIs like apps or big web frontends.
It's horrible in JS because of the boilerplate
It's ok in rust, at least you have types
Reading "Elm architecture" (https://guide.elm-lang.org/architecture/) it looks like classic MVC - they just call it Model / View / Update instead of Model / View / Controller.
If not, the rest of my comment is invalid.
> I personally can't stand the amount of boilerplate and "indirect thinking" that it requires.
Of course, just because you use a classic paradigm it doesn't mean the implementation thereof is elegant. And that might be because according to the Elm docs programmers "stumbled" upon it (reinvent) instead of designing for it: "Rather than someone inventing it, early Elm programmers kept discovering the same basic patterns in their code."
(Which is too bad, the ideas behind the project seem sound.)
Do Rust projects have a tenancy of becoming abandoned maybe due to the complexity of the language since it's hard to contribute? I've seen enough cases on this that prompted me to ask this.
Other languages don't have as fun a type system, so I feel bogged down and lose motivation before I even start writing code.
I don't know how many others this applies to, but I have a lot of abandoned Rust projects because if it wasn't in Rust, I never would have even started writing them down before abandoning them.
https://twitter.com/bodil/status/1520404060138094592
The author of this crate enjoys advanced type systems, and can't wait for Rust to add what you'd call "more complexity" in the form of higher-kinded types, generic associated types, and specialization (some of these features are available in an unfinished/experimental form in the nightly compiler, but may not become part of the language anytime soon, if ever).
Rewrite-in-Rust is a thing. Not only for applications but also for foundational libraries (crypto, http, async, etc). The ecosystem is still young with lots of gaps and many devs are experimenting with new approaches to fill those gaps. More new projects -> more abandoned projects.
Other languages had similar teething problems, just ask anyone with applications in Zope, WebPy, Pylons, Merb, JS frameworks not named React, EJB, MFC, etc.
The api is just better and gives you more for the bang