Rust
Learn Rust, the most safe, perfomant, and popular programming language.
Why Rust?
- Security
- Memory Control like in C
- No Gargabe Collector
- Statically Typed
- Imperative Language
- Compiled Language
- Solves memory issues that C has
- Addresses issues such as dangling pointers, double free, data-races
- Syntax: like C and Ocaml
- Rust forces safe programs via its type system
- Rust forces safe programs:
Recap: Stack vs Heap
-
Memory on the stack (primitive variables, functions) is automatically allocated and deallocated by the program as functions are called and return.
-
In contrast, memory on the heap (arrays, objects) must be explicitly allocated and deallocated by the program using memory allocation routines, such as
malloc()
andfree()
.
Stack - Automatic
- Programmers doesn't have to deal with
- Variables stored in the stack automatically
- Fixed size: Define how much memory to allocate in the stack
Heap - Memormy Managment
- Manual memory managment
- Dynamic size
- No fixed size
No Garbage Collector
- Rust tries to make Heap memory managment like Stack memory
- Rust says no Gargabe Collector
How Rust Fix These Issues
- Rust forces safe programs via Type system
- Variables with specified types: Int, Float, String, etc
- Rust also forces saf programs thru enforcing
- Ownership
- Lifestime
- It is very hard to write safe programs