首页 > Rust跟Go的比较有哪些不同?

Rust跟Go的比较有哪些不同?

Rust跟Go的比较有哪些不同?各自的优点和缺点?各自的应用场景?


Go: A better C.
Rust: A better C++, a practical Haskell.

@北方的狼 说得不准确。虽然它们都号称是「系统级编程语言」,但很明显,它们对「系统级编程语言」的定义不一样。

就像 /u/Manishearth 说的:

What happened is that Rust and Go are both new languages, claiming to replace C/C++ use cases (different use cases), both claiming to target systems programming (different definitions of systems programming), and both coming from major Web companies. These are superficial similarities and they target very different audiences internally (again, there is overlap, but most of it is recent overlap, and it's not the majority), but a lot of people used this to portray Rust and Go as competitors; and this meme continued for a long time. Now with the spreading of awareness this is less the case -- folks compare tooling and stuff now, but people consider the languages to be targeting different things.

所以,你不如找找看它们有哪些相同。


刚刚看了Quora上的同类问题: https://www.quora.com/How-do-Rust-and-Go-compare-1

我的一些浅薄的理解

不同:

  1. Go 更类似 C。Rust更类似C++。Go试图将语言简化,可以没有的就没有。Rust倒是有Generics这种。

  2. Go 还是有GC的。但据说最新版的Go的GC已经牛到不会stop the world了。Rust没有GC。而是用ownership, borrow这种东东保证内存使用的安全。

  3. Rust 保证thread safe。这是个大卖点。貌似Go没有。

  4. Rust 貌似library更多 。

  5. 用Go写的著名软件貌似多些。CoreOS, Docker, etc

相似:

  1. 都是编译的语言

  2. 都是系统编程语言

  3. 都试图解决C/C++的问题

  4. 都有channel这类东西

  5. 都属于比较语法比较简洁的

抛砖完毕


这篇文章你可以看一下(一个拥有3.5年go经验,进入rust的总结):https://medium.com/@deckarep/paradigms-of-rust-for-the-go-developer-210f67cd6a29

【热门文章】
【热门文章】