- Date: 2018-10-24
- Session overview: this session is an introduction to Rust. We review several characteristics of other languages and compare Rust to them.
A word on type systems
Learning Rust before Haskell: if you want to learn the functional paradigm, it is recommended that you learn Rust first because of its type system.
As you know,
In a Static language, types are determined at compile time. In a Dynamic one, they determined at runtime.
In a Weak system, different types may be comparable (
Rust variables and types
In Rust all variables are defined as
let var = …. It has type inference, which assumes the type depending on context. You can also tell it the type you want, for cases in which is absolutely needed or is ambigous.
If we talk about efficiency, any high level language has automatic memory management (via a garbage collector and the like), while Rust (like C and C++) has manual memory management (no gc)
Quote: "I wouldn't step on a plane whose software is running with a garbage collector".
Rust manages memory via its ownership system. When a function ends, it automatically frees all the variables it owns. To make a variable live longer, a function can transfer the ownership to another function when calling it. This system solves the double-free and malloc issues, amongst others.
Most loved language
Rust is the most loved language in the stackoverflow 2018 survey.
--> The rest of the session, we focused on reading through the first resource (A gentle introduction to Rust).