Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: Golang vs. Rust vs. Swift
11 points by think_freely on Feb 22, 2019 | hide | past | favorite | 11 comments
I'm interested in the modern, more memory-safe languages that were built to replace the use of C++ in various places.

I wondered what people may know of each one? Below is my limited knowledge.

golang Invented for back-end web development, by Ken Thompson and two others, backed by largely open-source corporation. Has pointers, no classes/inheritance, has own compiler, as well as gcc support. Wide OS and architecture portability. Outline of original design explained: https://www.youtube.com/watch?v=sln-gJaURzk

rust Invented for cross-platform desktop app, backed by fully open source organisation. Strongly tied to x86, incompatible with other architectures.

swift Invented for native apps on client devices, backed by mostly closed source corporation (but Apple gifted clang to the BSD world). Has some level of Linux support...?




This is like asking if apples or oranges or bananas are better. Rust, Golang, Swift ad infinitum all have their advantages and disadvantages.

First of all, you have not explained what the problem or issue is that you want to solve. Will you be working with bare metal? With networking? With native apps on iOS? So you should determine what it is that you actually would like to do, and then find a good fit from there.

All I can say is I like working with Go and Rust for different reasons. Rust has a slightly different paradigm, but I think people exaggerate the learning curve simply because it's just not what they're used to.

If you can't decide, then write a toy application in all three languages! This will give you a better insight into working with that language and its ecosystem. I.e. I still dislike how Go handles packages, but it's tolerable.


That's about my experience as well. I started playing with Swift when they launched it, and have dabbled here and there, but I don't have an iPhone or a Mac, so it's not very useful unless I really need to develop something for iOS (had a hackintosh for a while until my laptop died). I have since moved my prototyping to React Native targeting Android.

There are a lot of things to like and dislike about each language. I use Go at my day job and Rust for most side projects, and I feel I need to be careful with both. Go makes concurrency easy, which also makes it easy to make mistakes. Rust makes concurrency safe, which also makes it hard to optimize. I'm faster with Go in prototyping, but more confident with Rust not breaking at launch.

Learn them all. If you're an experienced dev, it'll take you less than a week to be comfortable with Go if you've done any concurrency, two weeks for Swift, and about the same for Rust (maybe more if you have little to no FP experience).


Swift is honestly the nicest of the 3 but a pain in the ass to use on anything other than Apple platforms. Yes, I know it runs on Ubuntu, I've done it, it's still not great.

Go is what it bills itself as, but I find it an eyesore to read and parse.

Rust feels to me like the best middle ground between the two, with an amazing ability to _force_ you to account for errors in a way the other two don't quite achieve. You'll spend eons on compile times, though.


I believe that the main value proposition from Rust lang, is more about the safety guarantees, without having a GC that can add some uncertainty for execution time. (I don't know Go but it seems the GC pauses are very short, so if you don't have hard real time constraint Go GC is probably not that a big issue)

So basically use Rust, wherever you need C or C++ performances and you cannot afford to have a bug. So critical piece of the infrastructure, OS, critical embedded systems... It is probably easier to write correct concurrent Rust than C.

The fact that you can easily create static binaries that will run on Linux or Windows is nice, but I don't think this is the biggest differentiator.


> Strongly tied to x86, incompatible with other architectures.

This is incorrect.


To add to this, here is a list of platforms that Rust supports: https://forge.rust-lang.org/platform-support.html


Does not matter any more. Just wrap it in a container, and put a grpc api on it (I.e. create a microservice). My preference is go, mainly due to the vast amount of open source libraries


Do a simple app in each one and see which one you like best. Something like a todo API or something like ls, cat, or grep. Doesn't have to be perfect or anything just enough for you to get a feel for the language. Preferably something with dependencies outside the stdlib since managing dependancies is something you'll have to do anyway so you may as well see how it is before you get a bunch of them.


In my experience. Golang's concurrency model is a lot nicer to work with. if you are doing heavy concurrency/parallelism stuff you should be looking at Golang.

Once you hit a wall with GC or want a good type system, then you can look at Rust. Note that rust is a big language with lots of concept from c++ and ml family languages. so you might need some time to get used to it.

I have no experience with swift, so I cannot say anything.


Shouldn't the title be: "Golang vs. Rustlang vs. Swiftlang"


rust works with xbox360 classic, go-lang works with the likes of debian chromebook14-bt as far as I recall.




Applications are open for YC Winter 2021

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: