5 ms·
The design goal of Rust is to have C++-like efficiency with all the benefits of modern programming language theory and practice, as well as some new innovations
by cynicalkane 9y ago
The design goal of Rust is to have C++-like efficiency with all the benefits of modern programming language theory and practice, as well as some new innovations. In particular, Rust wants to address the two problems of templating/polymorphism/generics and mutability/sharing with zero efficiency or safety sacrifices. (I am not a Rust developer, that's just my impression.)
If you like OCaml/Haskell/etc but find yourself wishing you could make mutability and ownership more safe, or write very fast code more easily, and are willing to give up higher-order type system features for it, consider Rust.
Go is a very different language than Rust even though both superficially resemble C. If you're using Go because you want something C-like but better, consider Rust.
- jpm_sd 9y agoIf I understand correctly, Go is the new C++ and/or Java, whereas Rust is the new C.
- ChrisSD 9y agoNot really. Rust is mainly "the new" C++ (and is also looking to encroach on C). Go is more like (a better) PHP or Java on a webserver.
- zerr 9y agoNo, it's more like Go is (not enough to be) new Python or node.js.
- weberc2 9y agoGo has very little in common with either of those languages except a GC. Go is statically typed, natively compiled, a good 10-100X faster, and it has great concurrency/parallelism stories. It also lacks classes and exceptions.
- zokier 9y agoFunny, I feel the opposite, Go being more like C and Rust being more like C++; mostly due Go's strive for simplicity while Rust seems more comfortable embracing C++ level of complexity.
- ovao 9y agoGo could be considered a modern C, in that it follow's C's spirit of simplicity and clarity at the expense of power and expressiveness, but it is often not used as a replacement of C for various reasons. One of Go's stated design goals was (and is) to achieve performance parity with C, but it falls short of reaching that goal in many cases. With its type system and support for generics (in C++: templates), Rust has much more in common with C++ than it does with C.
- staticassertion 9y ago> in that it follow's C's spirit of simplicity and clarity at the expense of power and expressiveness Wow, I strongly feel the opposite about C. It is hardly simple or clear - understanding what your code will do after the compiler's done with it seems almost impossible, reasoning about runtime behavior similarly so. The complexity involved in managing memory, etc, is so significant. But it is extremely powerful. I see go as being extremely simple, but also very weak in terms for expressiveness, relying on the runtime for memory and concurrency management. I agree that Rust has more in common with C++.
- ovao 9y agoI was shooting for a simple answer, but perhaps some more clarification would be useful. I describe C as "simple" in the sense that it's A) not a large language, by specification and B) somewhat by virtue of the former, there's generally a small range of possible implementations of any given problem (which helps C programs have "clarity"). Go is very C-like in that it also has both of these attributes, quite deliberately. C could be considered complex, however, by virtue of the amount of behavior that is unspecified/at the compiler's discretion. In that sense its safety often is difficult to reason about, but C programs themselves are generally easy to reason about. Go luckily doesn't have many opportunities for programs to be "complex" in that way. C is "powerful" in the sense that it offers programmers deep control over memory. Given that, (effectively) anything that can be implemented in any other language can be implemented in C, with varying levels of difficulty. It isn't "powerful" from the language perspective itself — in terms of expressiveness or the features that it affords programmers — in the same way that C++ or Rust are "powerful". A lot of the adjectives we use to describe languages aren't particularly well-defined, so some disagreement about them is almost a given. But hopefully that clarifies.