FEM Polyglot Programming - TS, Go and Rust
March 10, 2023Setup
- https://go.dev/doc/install
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Borrow Checker
- One of the most difficult to understand
- you can not have a mutable reference to a mutable var, readable and writable are split which makes it safe
{}
closure can enclose things for safety- avoid
mut
- reference is read only, mutable ref lets you manipulate the value
let
lets you change the types
let a: Vec<i32> = vec![];
let mut b = a;
b.push(5);
println!("a size: {}", a.len());
println!("b size: {}", b.len());
- Rust and typescript are very close
- Go uses
iota
Rust
-
Enums can have different types on items
-
Rust has nullables which are enums