When comparing Racket vs Rust, the Slant community recommends Racket for most people. In the question“What is the best programming language to learn first?” Racket is ranked 17th while Rust is ranked 21st. The most important reason people chose Racket is:
Realm of Racket teaches the big-bang approach for managing world state. It does so by walking the reader through the development of small games. There are few guidebooks that are as useful and entertaining.
Specs
Ranked in these QuestionsQuestion Ranking
Pros
Pro Realm of Racket is an excellent entry-level guidebook
Realm of Racket teaches the big-bang approach for managing world state. It does so by walking the reader through the development of small games. There are few guidebooks that are as useful and entertaining.
Pro Racket was designed to teach functional programming from the start
Racket is based on Scheme (LISP Family) and is very similar to Clojure. So there are a ton of (). The reason it is easier to learn is that it is not trying to be "Pure" if there is even such a thing in terms of Functional Programming. The great thing about Racket is it has everything included. You get DrRacket for developing programs. You want to add a picture to your software you can insert pictures. If you want to add libraries just open the package manager. The Syntax is an opinion but it really does feel easier to see what is happening since everything is in brackets)
Racket is a really a Programming Language for making Programming Languages. So there are smaller syntax Racket called Student Racket which makes things easier to pick up.
Pro Free resources to Learn
Includes several free online books and great documentation.
Pro Great RPEL IDEA included Dr. Racket
Pro Active community
Racket has an active community of users/developers that makes it easy to get help when needed.
Pro Syntax fits to functional programming
Although syntax is different from that of mainstream languages, S-expressions are a perfect match to functional programming.
Pro Subtly encourages functional programming
Racket makes it inconvenient to pursue imperative habits while encouraging functional programming by Lisps's syntax. For example, the syntax for defining a function is almost the exact same as defining a variable. In addition, Racket has a strong set of higher-order functions built in to the language.
Pro Easily embeddable
Racket is famously embedded in the game engine underlying Naughty Dog's Uncharted and The Last of Us games, because it proved to be so easy to embed.
Pro Catch errors at compile-time
Since Rust is statically typed, you can catch multiple errors during compile time. This is extremely helpful with debugging, especially compared with dynamically typed languages that may fail silently during runtime.
Pro Compiles to machine code allowing for extra efficiency
Rust uses LLVM as a backend, among other things this allows Rust code to compile down to machine languages. This allows developers to write programs that run as efficiently as possible.
Pro Threads without data races
Unique ownership system guarantees a mutable data to be owned and mutated by only one thread at a time, so there's no data race, and this guarantee is checked at compile time statically. Which means easy multi-threading.
Of course, immutable data can be shared among multiple threads freely.
Pro Generics support
You don't have to write same array and dictionary classes hundreds and thousands times for strong type check by compiler.
Pro Built-in concurrency
Rust has built-in support for concurrency.
Pro Supports cross compilation for different architectures
Since Rust 1.8 you can install additional versions of the standard library for different targets using rustup/multirust
.
For example:
$ rustup target add x86_64-unknown-linux-musl
Which then allows for:
$ cargo build --target x86_64-unknown-linux-musl
Pro Makes developers write optimal code
Rust is a modern programming language written around systems. It was designed from the ground up this way. It's language design makes developers write optimal code almost all the time, meaning you don't have to fully know and understand the compiler's source code in order to optimize your program.
Furthermore, Rust does not copy from memory unnecessarily, to give an example: all types move by default and not copy. Even references to types do not copy by default. In other words, setting a reference to another reference destroys the original one unless it's stated otherwise.
Pro Support for macros
When you identify a part of your code which gets repeated often, which you cannot abstract using functions or classes, you can use Rust's built-in Macros.
Pro Official package manager and build tool
Cargo is the official package manager for Rust. It comes with the language and downloads dependencies, compiles packages, and makes and uploads distributable packages
Pro Easy to write understandable code
While not as verbose as Java, it still is much more verbose than languages like Go and Python. This means that the code is very explicit and easy to understand.
Pro Big community
The biggest community contributing to language.
Pro Functional programming
Very easy to create functional with some additional from structure application.
Pro Excellent syntax
Pro Safety
Pro No GC
Pro Low memory usage
Pro Static compiled & statically linked single file output
Pro Extremely fast code execution
Pro Zero-cost futures or Async IO
Cons
Con Long compile times
Way longer to compile than other languages.
Con Low productivity
The compiler is strict, such as ownership and borrowing checkers.
Con Low readability
Harder to read and understand language.
Con Very ugly and verbose syntax
Compared to many languages. One tool needed to be productive is the language to be pleasing and effective, yet Rust friction is as high as its safety.
Con Steep learning curve
Pretty strict and hard to adapt for beginners.
Con Not as useful or productive as advertised.
If really out here wanting to use something besides C/C++, in 98% of use cases, would do just as well or be better off using something other than Rust. Will complete the project faster, would be easier, will be happier, and nearly as safe (use newer language with optional GC).
Con Rust not as safe as it pretends to be
Rust problems:
1) Massive undisclosed usage of unsafe.
2) Massive amounts of memory safety CVEs - see details.
3) Large bloated Rust binaries increase attack surface for exploits.
4) Many corporate types claiming Rust is safe, don't actually program or use it (have some quiet financial interest to push it).
Con Significant time required to understand the language fully
There's the infamous borrow checker for example.
Con Low-level programming language
This means that it encourages the programmer to be very careful in terms of how memory is allocated, etc.
Most applications can run without exceeding the capacity of the server, even with an inefficient dynamic scripting language.