6 ms·
This may not be the message of the article but as a side-rant: I really don't understand the use-case for a Rust-based GUI. Rust's syntax, manual memory manag
by TobyTheDog123 3y ago
This may not be the message of the article but as a side-rant:
I really don't understand the use-case for a Rust-based GUI.
Rust's syntax, manual memory management, and compile times makes it seem like it's really not meant for this kind of workload, but instead for things like compilers, embedded systems, that kind of thing.
I understand that not every UI needs to be a cross-platform blah blah blah written in TypeJavaReactScriptJS, or a pixel-painted canvas written in Flutter. I also understand there's a use-case for one-off UIs that may not target a browser.
Let's compare it to something like Golang. Fast compile times, similar libraries, garbage collection -- it seems like something more suited for UIs where there are usually a lot more iterations. Worse performance for sure, but Rust also seems more-than-overkill in that regard for the UI use-case.
- winstonewert 3y agoFrom a Rustacean's perspective: Golang is a no go because it lacks enum types, sensible error handling, generics (I think it has some version of this now), non-nullable types, or macros. Once you've gotten used to using these kinds of features in Rust, it is really annoying to go back and work in a language that lacks them. Basically, golang takes such an opposite design approach to Rust, that if you like Rust you'll probably hate golang. We also find that once you get used to the borrow checker, we mostly don't miss garbage collection. And garbage collection isn't a panacea either, as almost any large project still ends up with memory leaks caused by stray references. So, basically, we like Rust and think its a well designed language. It is quite frankly better, as a language, than any of the alternatives that we could be writing in. As such, it'd be nice if we could develop GUI applications in it.
- 8note 3y agoIf you're going to use electron and all the bad that comes with it, why not just use typescript though?
- baq 3y agoI love typescript, but hate the JavaScript parts of it.
- jeroenhd 3y agoWith a good linter config set super strictly, you can make Typescript feel like you're barely writing Javascript at all. Any Javascript devs will probably hate working like that because now they're forced to write types for absolutely every single thing, but to me it felt like Javascript was finally fixed. Just banning things like "any" and enforcing proper nullability makes up for a lot of Javascript problems.
- bmikaili 3y agoThis is the worst part of JS. To make it workable u have to: - setup linting (which is awful and annoying) - formatting - use typescript and then maybe u have a usable work environment. Rust just does that out of the box.
- TobyTheDog123 3y agoI disagree - Javascript's issues are not just its lack of type safety. Even with Typescript you're dealing with the disastrous state of NPM/configuration/linters/formatters/libraries -- all of which are firmly Javascript-esque plagues (though not exclusively Javascript plagues).
- winstonewert 3y agoBecause even though typescript improves on Javascript and even golang, it still is much less nice than Rust.
- 0000000000100 3y agoYeah it seems to be a pretty niche use case. The learning curve for Rust is simply too high (my GOD the syntax). You can just get much more done, in less time with a web framework. I looked into Rust for writing games (including the UI frameworks), but found that the power it provides isn't really worth all the mental overhead. Most games don't really need that much power, particularly if you are using non-realistic graphics. In the event that you do actually need extra optimization, most engines let you hook down into C++ for raw performance.
- alpaca128 3y ago> The learning curve for Rust is simply too high (my GOD the syntax) The syntax isn't even close to being a difficult part of the language, and it's something you get used to very quickly. The Rust syntax just isn't readable for people who don't yet know Rust, just like I find C++ difficult to read. > You can just get much more done, in less time with a web framework. Sure, you can also get it running even quicker in Python. But when it comes to maintenance I prefer something where the type system wasn't just slapped on top. That said the web does feel like the only fully-featured and truly cross-platform GUI at the moment.
- pkolaczk 3y agoThis is a matter of familiarity. For example, Golang is claimed to have simple syntax, but I find Golang's syntax much harder to read than Rust. The fact they avoided keywords and symbols like a plague caused that now e.g. function signatures are mostly names, spaces and parentheses, and the meaning of them depends on their relative positions, which is something I'm not used to. I guess if I wrote / read Golang sources more frequently, that would become a second nature and would not slow me down.
- crispinb 3y ago> This is a matter of familiarity No it is not. Or at least not for everyone. I have learned several languages more unfamiliar to me than Rust (pure functional, logic, stack-oriented,etc), but none has given me the difficulties Rust has. Also (only my sample of course, but there are no reliable stats) no-one I personally know who has gone through the Rust book has continued with Rust. The Rust Foundation hasn't made 'flattening the learning curve' one of its 2024 goals because people don't find Rust harder than other languages. Many just do. A false universal doesn't become true through brute repetition.
- crispinb 3y ago> I really don't understand the use-case for a Rust-based GUI. For people already writing things (libraries, cli's etc) in Rust who want to add a GUI while staying with the language. No great mystery. As for a business case, aside from individual developer taste/preference, it's hard to see that there is one outside of niches. System76 found a case for it with their DE. I think there might be a strong case for lightweight Rust GUI frameworks like egui for embedded device displays. But for mainstream web / desktop / mobile apps? I can't at the moment see what the point would be.
- cyber_kinetist 3y agoThings are a bit different in certain graphics app domains, where you need to create complex tools for professionals (think of image editing, 3D modeling, video processing, CAD, game engines, etc.) The users demand all kinds of functionality that requires squeezing the CPU and GPU to the fullest extent. And you have to do this while designing a complex UI with numerous complex controls, and it also needs to be butter-smooth. (Also note that the majority of the low-level APIs/drivers you need to use are in C/C++!) In that case, using languages like Go/Java/Javascript creates more problems than it solves (even if you only write the core in C++/Rust and use bindings.)
- virtualritz 3y ago> Rust's syntax, manual memory management, and compile times makes it seem like it's really not meant for this kind of workload, but instead for things like compilers, embedded systems, that kind of thing. What about a vector or image editor, a 3D DCC etc? These are prime example for desktop apps where existing solutions are 100% written in C++. That's stuff where Rust would be a better alternative if you started work on an app like this today. In VFX there is a whole initiative by the ASWF to wrap the stack in Rust for starters and possibly have new additions written in that language instead of C++ in the future. And compiling to WASM and being able to run in a browser (even if only as a single canvas element with all applying limitations) is a great plus.