Settings

Theme

Deciding between Rust or Go for desktop applications

3 points by b1zguy 3 years ago · 7 comments · 2 min read


I'm looking to expand my programming skills from web apps, automation, scripting - mainly Python - to more traditional cross-platform, desktop-based (but GUI lite) apps because I progressively want to get closer to the metal (one day work with embedded systems). Nevertheless, I currently desire to create desktop tools like I've done in the browser and with automation scripts in the terminal or web servers.

The apps I wish to make need to interact, listen and change things outside of the browser or terminal console. I'll start with making simple programs that automate on the desktop before I make fully-fledged GUIs. Some examples in mind involve monitoring network traffic and changing some system settings, listening to and manipulating clipboard data, or interact with common hardware peripherals. I hope these examples give you an idea of my intentions. In addition, I did learn a little C++ and C yonks ago.

I believe Go is more suitable for desktop applications that a user interacts with, whereas Rust is better suited for programming lower level hardware behaviour/capabilities or getting closer to the kernel? So in other words, perhaps Go is like a better replacement for C++ and Rust is a better replacement for C? I acknowledge I'm providing gross simplifications here.

And it almost goes without saying, * I'm not asking what is the best language *. Rather, based on what has been described, which language would be most strategic to learn given my goals and intentions?

In another way what are the strengths and weaknesses of Go and Rust? When should one use the other?

Thank you in advance!

pjmlp 3 years ago

Neither of them have GUI tooling for desktop applications comparable to Swift, Objective-C, Java, C#, C++.

Taking that into account, Go would be preferable, as proven since the days of Xerox PARC, GC based languages (regardless of the actual GC algorithm) are much productive for GUI development.

With this in mind, https://fyne.io/

yokaze 3 years ago

> cause I progressively want to get closer to the metal (one day work with embedded systems)

Don't see the point in going for desktop apps. If you want to broaden your skills, that's great, but it's not a progression in skills.

For both server side programming as well embedded development, UI is less of a concern, and you control often the whole platform/OS.

Desktop apps require skills in UI development and also you have to bother to learn multiple platforms. Libraries and languages only do so much in providing an abstraction.

Also it depends on what you understand with Embedded systems. They range from full fledged windows/Linux/... systems (quite close to desktop apps and more UI programming needed) to PICs.

In my view, the programming language is the least of the concerns and a small part of the skill set you'll need to acquire.

Choose the tools you feel comfortable with in the problem space you want to work in.

There is micropython as well.

SvenL 3 years ago

I would go with Rust, because it’s also suited for embedded scenarios. Also, there is some Rust support for Windows API development (https://learn.microsoft.com/en-us/windows/dev-environment/ru...). I think there is even some initiative to support Rust with WinUI 3 but I can’t find the blog post about it. So if you’re developing on Windows you’re covered.

DaSexiestAlive 3 years ago

Go easy on yourself. Write desktop apps in something you are already familiar with--HTML, CSS, Javascript--with the help of Electron. Then using interfaces like Neon, you can rewrite hot-pots in Rust/Go. All you gotta do is profile your code from time to time to find out where the hot-spots are.

Labienus 3 years ago

I would check out the WebAssembly VM. There are many projects aiming to make it a lightweight embedded standard, and it's also in browsers. I think learning a bit about it might help swap between web/embedded.

WebAssembly also support WASI, a way to access OS system services. You can even access the GPU with WebGPU/wgpu at the same time.

For a GUI applications, Slint/egui/Rust offer cross platform GUI-toolkits that target embedded.

Cloudflare recently open-sourced workerd, a WASM/JS runtime that acts as a server/HTTP proxy. You can maybe use that monitor network requests, in combination with the above to manipulate OS/GPU/etc. at the same time.

Both Go and Rust compile to WebAssembly. They both support bindings for WebGPU and WASI. You can use whatever floats your boat and just compile to WebAssembly. The future is here my friend.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection