7 ms·
I've started to notice there are a lot more rust based desktop application appearing vs say Go based or Java. Most of these apps are cross platforms. My guess i
by mattfrommars 1y ago
I've started to notice there are a lot more rust based desktop application appearing vs say Go based or Java. Most of these apps are cross platforms. My guess is they are trying to compete with Electron. There is Tauri runs on Rust.
Can someone please tell me what special about Rust? Say, why aren't desktop application popular based on say Python?
On tangent, ive seen a lot of terminal base application in typescript and go
- culinary-robot 1y agoI have a background in macOS applications, back when it was Objective-C. I have always loved native apps. When i decided to start Halloy the goal was to create a native application for multiple platforms, and for that Rust is perfect.
- Rendello 1y ago> Can someone please tell me what special about Rust? I think I've seen this topic pop up from time to time ;) For me personally, I've been replacing a lot of my Python programs with Rust. A lot of it isn't much harder to write, and things like sum types are sorely missed when I write Python or most non-Rust languages. And usually, if my Rust program is a lot more difficult to write, it's because I'm exploring an optimization that wouldn't be possible or worthwhile in Python. Having an application be native and compiled is a big plus for me. I plan to release a desktop app in Rust but it isn't at that stage yet.
- WD-42 1y agoI am currently writing a desktop application in Rust. It’s a jellyfin client for music. I think the main reason is that writing Rust is a joy that gives you confidence. This is important to me as I often have small amounts of time to work on it (new dad). With rust I can start implementing a small feature, as long as it compiles I can be reasonably sure it works. In Python I’d be wading through a sea of runtime errors and never quite sure I actually got it right. Cross platform is another good reason. UI library support is good. You have iced like this app, but also decent GTK bindings. No runtime needed makes distribution and packaging infinitely easier than Python. It’s a great language for writing desktop apps.
- stavros 1y agoAs a user, I agree, I really like downloading a single, small binary that is a full-fledged desktop app. Hell, I downloaded Halloy just because it wasn't Electron, and it looks really nice, too!
- Imustaskforhelp 1y agoI feel like the same can be said for golang but rust just has a more pleasant way of sometimes doing things. some of the best ways to build gui's on golang might be gtk golang bindings imo. I haven't tried qt but gtk for linux should work. I have seen many apps also use golang as backend and flutter as frontend (warp android app wormhole or something and localsend both do this)
- have_faith 1y agoAny way to follow your progress? I considered writing one myself, although not rust based.
- WD-42 1y agoSure :) https://github.com/Fingel/gelly https://github.com/Fingel/gelly
- 20after4 1y agoGood point about Python. Python is so hit or miss on every platform and it's kind of difficult to distribute any complex python app unless you distribute your own python build along with it. Otherwise you have multiple levels of dependency hell, unique to each platform.
- 1718627440 1y agoThere I quite a lot of desktop apps in Python. But for example if you use Tkinter, it looks awful on Linux and if you choose Gtk, you need to build the python version on Windows manually in minGW or ship Cygwin.
- gertop 1y agoThat's more of a GTK problem than a python one. It sucks on all platforms that isn't Linux. In my experience apps using pyqt5/6 have a much nicer interface and cross platform experience.
- 1718627440 1y agoHow does Qt help with that it isn't implemented in Python, so you need a binary, which is OS specific? GTK wasn't that hard either once I had figured out how MinGW works. All you essentially need is to setup a working C compiler for Windows. You don't even need to figure that out yourself, because all you need to do is to tell the MSYS2 package manager to install a python version, that has GTK support. In my opinion the problem is more that support for more Toolkits isn't built into Python so you essentially need to deal with another language as well, which sucks when you only know python. Distributing Python for Windows is even harder than for Linux.
- righthand 1y agoRust produces a single binary. Developers appreciate this when shipping an app. For Python based apps you usually need your user to have Python installed and then ship a bunch of Python files with interop to some non-Python UI library. So you probably need to ship the UI library as a dependency too. Or you can just build it in Rust and learn what .unwrap() does.
- az09mugen 1y agoI don't say it is best, but there are solutions like pyinstaller [0] to produce a binary from python code. [0] https://pyinstaller.org/en/stable/ https://pyinstaller.org/en/stable/
- righthand 1y agoThis just obfuscates the issue not actually fixes it. This is 1 binary + all the previously mentioned files.
- thyristan 1y agoThere are no languages with good GUI frameworks except C, C++ and C#. All other bindings typically suck ass.
- MangoToupe 1y agoAnd presumably C# is just binding to some native toolkit
- 0x457 1y agoYes, but C# is very nice as a language for GUI, can't explain it, just feels right.
- MangoToupe 1y agoUnfortunately, that's a mostly-windows thing. I can't say i've ever used such an experience myself.
- nobleach 1y agoIf I had to simply bind to a native toolkit, I think Lazrus can do that. Having loved Delphi back in the day, I think I'd prefer to write ObjectPascal for anything more than a very simple utility. C# would likely be my second choice.
- PaulDavisThe1st 1y agoThere is no native toolkit on Linux, at least not in the sense that there is on macOS or windows.
- MangoToupe 1y agoYea but linux doesn't have a toolkit at all, in that sense, and suffers deeply for it. Imho
- gtirloni 1y agoLatency. Go and Java with optimizations can work just fine, Python not so much yet.
- MangoToupe 1y agoIt just works, it can do most anything, and it binds well with C.
- linhns 1y agoAlso much easier to manage packages, which for me it’s the differentiating factor.
- airstrike 1y agoFast. Explicit. Safe. Cross-platform. Did I mention fast?
- eikenberry 1y agoGiven the other answers here focusing on the single binary as the main benefit, Go would seem the only competitor of those listed and Go lacks good support for GUIs. Most GUIs are written in C/C++ and Go doesn't have as good a story for C/C++ integration (community convention is to generally avoid it if at all possible). IMO as Zig matures you'll see it grow as a language for GUIs. You get the same cross platform support, single binary generation and C integration with better tooling and a language with a significantly lower cognitive load.
- gertop 1y agoFunny how nobody has actually addressed your question, choosing to praise rust instead.. The answer is that there are several python GUI applications (a dozen music players, Cura, Calibre, Anki, Deluge, etc). Hardly any Go because all bindings suck (which isn't that surprising, go devs are often hostile to cgo) and there's no (non toy) native toolkit either. I'd don't know why that is. Every few years I look for one but I give up and write the UI for my Go tool in html instead...
- timeon 1y agoJust side-note: lot of non-GUI parts of Anki are now written in Rust and GUI is slowly moving to Svelte/TypeScript.
- rtpg 1y agoI've tried writing GUIs with Python in the past and it was a bit tricky to get the pieces working. The one Python GUI that comes to mind that is also, like, not garbage looking is Anki.
- 20after4 1y agoI can't speak to rust but I think the reason you see CLI tools and Servers written in GO is simply because that is where the language really shines. I don't think it would be very much fun to develop a desktop GUI app in GO. Go is kind of verbose and just a bit hostile towards fancy structural features and complex abstractions. I think rust is kind of the opposite of GO in a lot of ways, even though they theoretically should be targeting a lot of the same use-cases.
- TheDong 1y agoGo and Java are actively hostile to integrating with C libraries, and the easiest way to make clean native UI on all 3 major OSs is to link with C libraries. There's also something akin to the Python Paradox here: https://www.paulgraham.com/pypar.html https://www.paulgraham.com/pypar.html Rust is an interesting and intellectually stimulating language, it lets you use your brain to write clean and pretty code, and rewards you for making clean powerful abstractions. Java and Go are both anti-intellectual languages that reward you for turning off your brain and writing the most verbose awful code you can think of, and will leave anyone who has ever studied type-theory with a massive migraine for hours after each coding session (go moreso than java). I think those two factors, C bindings, and whether they respect the programmer's intelligence, are the main reason.
- yoz-y 1y agoWith Python I find that distribution is too much of a pain (I don’t mind creating a virtual env for a cli tool but for a GUI forget it). I love that go links everything statically and so far I haven’t had any problems running rust tools.
- philipwhiuk 1y agoI can tell you that writing Java GUI applications is hell. You have the following libraries: AWT - still actually under-pining the others, but very ugly to work with Swing - basically runs on top of AWT, with the same design model, plays badly with it. Is hard to write in a testable way, is prone to embedding business logic in UI components JavaFX - all the worst parts of business Java with all the worst parts of XML and also the worst parts of a game engine. Now you need to care about 'adding a scene to a stage'. The principle core technology that made Java good was applets. Since they were killed by mobile, the reason for delivering a Java app is functionally zero. You will need to ship a JVM which you need to update alongside your app. Java is a great back-end development language and a really poor GUI language. These days you should either ship an Electron app or native code.