FEM Polyglot Programming - TS, Go and Rust

March 10, 2023

Setup

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