3 ms·
> The background for this is that most existing UI toolkits are a poor fit for Rust. Being in GUI business for almost 30+ years I shall admit that this above i
by c-smile 4y ago
> The background for this is that most existing UI toolkits are a poor fit for Rust.
Being in GUI business for almost 30+ years I shall admit that this above is true. And not just Rust but C/C++ are there too.
Real (a.k.a. practical) GUIs are multi-paradigm entities. Same GUI implementation may have React'ive alike widgets immersed into purely declarative DOM/widget tree with elements of immediate mode graphics on top or inside that.
It is just that GUI reflects complexity of real life - you cannot say that sickle and hammer are best tools for everything...
Back to Rust... As a language behind UI Rust is the worst language imaginable. That's primarily due to its strictness.
Object ownership graph in GUI is usually quite complex. yet it is dynamic and frequently contain loops. This situation is best handled by GCable languages. On-click-here-highlight-the-thing-there-and-remove-that-one.
Also each part of UI declaration needs it's own DSL: for UI structure definition, style system and logic behind the UI.
Before arriving with Sciter [1] I've tried [2] many things for UI: C++, D, Java, etc.
Conclusion: HTML/CSS/JS is the best (most flexible and multi-paradigm) solution that we've got so far. Not perfect of course but good enough. And considering existence of Sciter it can be fast and lightweight.
Practical example: RustDesk (https://github.com/rustdesk/ https://github.com/rustdesk/ - remote desktop access) is using Sciter for UI layer and Rust for app logic layer. So it is using proper tool for each task.
[1] https://sciter.com https://sciter.com
[2] https://terrainformatica.com/2014/07/17/10-years-road-to-sciter/ https://terrainformatica.com/2014/07/17/10-years-road-to-sci...
- gpm 4y ago> Also each part of UI declaration needs it's own DSL: for UI structure definition, style system and logic behind the UI. This is actually one thing I think rust has going for it, the procedural macro system makes it possible to embed reasonably arbitrary DSLs in rust.
- c-smile 4y agoRust can be good for implementation of UI system but as a language-behind-UI it is bad - its advantages (e.g. strictness) directly translate to disadvantages in that area. At the end, main idea of initial Rust design is to be the language with what browser is implemented. JavaScript (in ES2020 specification) is really good enough as UI automation language. If not JS then TS. Just in case in Sciter I've added native JSX to JS. JSX is an ergonomic way of defining tree alike literals that used for UI DOM population and patching.