Comment by ๐Ÿš€ ostov

=> Re: "Building native UI applications on Linux in the declarative/..." | In: u/ostov

To: @jeang3nie

The problem is in the interface code. I don't understand how to redraw the window interface when the given data changes.

This is critical for social applications where the interface is not static.

We usually have a State in which we store objects like blog posts. Then, when this state changes, it sends this state to the render function, where the interface is redrawn according to the state.

I'm a bit confused on how to organize this in GTK (Vala in particular).

=> ๐Ÿš€ ostov [OP]

2023-06-02 ยท 2 years ago

2 Later Comments โ†“

=> ๐Ÿฆ€ jeang3nie ยท 2023-06-02 at 14:34:

@ostov I see. There is no overall render function in Gtk+ as it isn't an immediate mode gui, but retained mode. Each widget has it's own internal state, and you have to update whatever widgets that you wish to change. There are tradeoffs with any method of working and this way has plenty of tradeoffs.

=> โ˜•๏ธ Morgan ยท 2023-06-02 at 17:32:

Flutter works exactly as you describe; redraws are automatic from state. It's not JS, but then JS is not "native", although I was not clear if Flutter fits what you want there either. It can compile to binary code, it's native in that sense :) ... agreed about it not looking very desktop-like, I guess that may come later as desktop support is relatively recent.

Original Post

=> ๐Ÿš€ ostov

Building native UI applications on Linux in the declarative/reactive way? โ€” I like GTK+ visually. It's minimalistic and all applications look organically on one Gnome-based desktop. But when I decided to write an application myself for my favorite OS (Elementary), I went into a stupor. You can only write in Vala+GTK in HORRIBLE imperative style. After a long time programming in [Lisp Racket] and [JS], I can't go back to this. I can't imagine programming without lambdas and stateless...

=> ๐Ÿ’ฌ 8 comments ยท 2023-06-01 ยท 2 years ago ยท #coding #declarative #linux

Proxy Information
Original URL
gemini://bbs.geminispace.org/u/ostov/1432
Status Code
Success (20)
Meta
text/gemini; charset=utf-8
Capsule Response Time
77.34058 milliseconds
Gemini-to-HTML Time
0.52443 milliseconds

This content has been proxied by September (3851b).