The Rust
that could have been

ProseMirror

CodeMirror
Marijn Haverbeke
Timeline
Graydon
Mozilla
Stable
Me
Visions
Typestate

& the dream of static safety

Compiler Knowledge

                               
JavaScript     Rust               Coq
pure fn not_empty(a: [int])
  -> bool { ... }

fn last(a: [int])
  : not_empty(a) -> int { ... }

let my_array = [1];
check not_empty(my_array);
log(last(my_array));
Structural typing    
& economy of concepts
type point = {x: float, y: float}

fn angle(vec: point) -> float { ... }

log(angle({x: 4.0, y: 2.0}));
type collection<T> =
  obj { fn length() -> int
      ; fn item(int) -> T }

fn is_big(c: @obj { fn length() -> int })
  -> bool { ... }

log(is_big(my_collection));
Lightweight processes
(millions of them)
Thread
Task
Thread
Task
Task
Task
Task
Task
Task

Segmented stacks

T1
T2
T3
T4
T5
Garbage collection
(because you have to)

Returning a closure

fn factory() -> Box<Fn(i32) -> i32> {
    let num = 5;
    Box::new(move |x| x + num)
}
Thanks for listening!
@marijnjh
github.com/marijnh