4 ms·
I have a genuine question. One of Rust's biggest plus points is having no GC and the related overhead at runtime. Go, on the other hand does use GC. Then how
by sidcool 8y ago
I have a genuine question. One of Rust's biggest plus points is having no GC and the related overhead at runtime. Go, on the other hand does use GC. Then how come so many successful Systems programs (e.g. Kubernetes) are written in Go. Anything I am missing here?
- gbear605 8y agoFor one, because in many systems situations, having the garbage collector slowdown is okay. Also Kubernetes is probably a bad example since it’s a Google project and Google is of course going to use Go more than most companies would.
- phkahler 8y agoGC is one of those features that divide languages. It isn't a big limitation but it usually precludes hard real time performance. Rust caught the public's attention more recently than go. Both are still in their early days as far as adoption is concerned.
- amelius 8y agoRust is still in research phase, as many programming patterns have no clear counterpart in Rust. Even though Rust's approach is very interesting, it might very well be that its strict typesystem turns out to be a dead-end for some existing programming patterns. Also, writing self-referential data-structures is very difficult in Rust (but not impossible) due to the type system. I suspect that a lot of developers who just want to get work done get turned off by fighting with the typechecker, and choose GoLang instead. And also: GoLang is a very accessible language, that can be mastered in a couple of days.
- 0815test 8y ago> Also, writing self-referential data-structures is very difficult in Rust (but not impossible) due to the type system. Not really true (at least, not nearly to the same extent) since Pin<> was stabilized. I suppose that only serves to prove your point about Rust still being "in research phase", though!
- amelius 8y agoGood to know, but I guess that Pin<> does not solve the problem of indirect self reference, such as when you have a tree where every node points back to its parent (e.g. for convenience or performance reasons), or a doubly linked list where each link has a forward and backward pointer (?)
- sidcool 8y agoThen does investment in learning Rust have any merit?
- tomjakubowski 8y agoYes. If your style of problem solving suits language features like pattern matching on sum types and type classes, then Rust would probably be a more productive language for you than C++, and it would be beneficial to learn it.
- cpuguy83 8y agoMany reasons to choose go over rust. First and foremost, Rust was not 1.0 and was still making breaking changes when Kubernetes came around. Other things like the situation with async/coroutines is still it great in rust. Go is, syntactically, a much simpler language than rust. It all depends on what you need, what you want, and where then community around it is (e.g. Docker came first and was written in Go).
- LeonidasXIV 8y ago> how come so many successful Systems programs (e.g. Kubernetes) are written in Go This is because what you call "systems" is not the "systems" that the lack of GC would benefit from. For all intents and purposes Kubernetes could be written in Python or any other general purpose programming language (and for example OpenStack is in fact written in Python). On the other hand, systems like "writing an operating system kernel" or "running on a microcontroller" are things where GC might indeed be problematic and/or impractical.
- geodel 8y agoYou are missing the obvious. Go has may successful projects because some people chose to write software in Go as opposed to just have opinion and debates on PL theories, GCs and runtimes. Now I am not arguing one way or another. People can just have opinions or they can just write software or they can do both.
- apta 8y ago> (e.g. Kubernetes) Kubernetes may as well have been written in Python. It's mainly IO bound, so the benefits of compilation as opposed to running on an interpreted VM (like Python) aren't that big.