Hacker News

Relm4 makes developing beautiful cross-platform applications idiomatic

25 points by Bluestein ago | 13 comments

WD-42 |next [-]

I used plain gtk-rs for my last project and there is definitely some friction between rust and the gobject system. I think for my next project I will give relm4 a try. Apparently you can always drop back to gtk-rs if needed.

slacknatcher12 |next |previous [-]

Reading the documentation, I just notice lots of familiarity with my own solution using haskell and gi-gtk4. I think that anybody that read https://bichanna.github.io/posts/tea-time/ will get the same ideas. This basically boils down to:

1. Use a native widget system such as GTK (I evaluated Qt too)

2. Wrap widgets into a component datatype that is aware on how to update the widget when the props/model changes.

3. Define a dispatch closure that is passed to widget that accepts messages. Actions on the widgets should use this instead of mutating a reference.

4. That dispatch closure is component aware and it will call the update function on all the widgets.

There are some extra complications for long running computations but the model is a good base to build on. I wish the best to the relm team, most likely I will use them when programminmg in rust.

manmal |root |parent |next [-]

I haven’t used Haskell much. I thought to try it with agentic help, but then read this post that its compilation times might make it unviable. But what’s your experience?

zeendo |root |parent |previous [-]

Is your Haskell solution open source?

comex |next |previous [-]

> Built on GTK, Relm4 runs on bare metal with no additional runtime in between.

So, not native in the sense of using or even resembling the native UI toolkit.

vpzom |root |parent [-]

unless, of course, your native UI toolkit _is_ GTK

ThrowawayTestr |next |previous [-]

Why no examples of how "beautiful" this library is?

pitched |root |parent |next [-]

You have to head to the documentation to see an example. It is still Rust, which is a bit of an acquired taste so keeping that beauty off the main page makes sense.

manmal |root |parent [-]

I got a 404 when heading to the examples.

Klonoar |root |parent |next |previous [-]

Because it’s GTK4 and it’s expected that you know what that is if you’re using this.

danpalmer |root |parent |previous [-]

What do you mean, there's a screenshot link right there in the docs: https://docs.rs/crate/relm4/assets/screenshots /s

pitched |next |previous [-]

This is Gnome/GTK, not cross-platform like I would have expected. A Linux-first approach. I’m happy that this is the world we’re in now but expect it still to be royal pain to get a build running on Windows. Huge congrats to everyone involved if not!

thataccount |previous [-]

I had to read the comments to figure out whether this was AI or not. I guess that's a sign of the times...