Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Rust - Lightning Talk

Rust - Lightning Talk

Rust, and why it does what it does

Lito Nicolai

March 01, 2016
Tweet

More Decks by Lito Nicolai

Other Decks in Programming

Transcript

  1. Why is it called Rust? They have *five* stages of

    life (humans only have two) that they can move back and forth between
  2. Goals of Rust: Can we do that while managing the

    computer’s memory directly?
  3. Goals of Rust: Can we do that while managing the

    computer’s memory directly?
 
 YES!
  4. Goals of Rust: Can we do that while managing the

    computer’s memory directly?
 
 YES! (yay language research!)
  5. Safety vs Inconvenience A spectrum! (extra programmer time, learning) Proven

    correct before run Only runtime errors (all errors are logic errors)
  6. Ok, it’s not that simple at all. Shhhhhh There are

    many kinds of correctness, and many different costs of correctness. but stick with me
  7. Safety vs Inconvenience • More annoying than Ruby (extra programmer

    time, learning) Machine code C Rust LISP Ruby
  8. Safety vs Inconvenience • More annoying than Ruby • Fewer

    errors allowed (extra programmer time, learning) Machine code C Rust LISP Ruby
  9. • Immutable reference to immutable data • Immutable ref. to

    mutable data • Mutable references to… Degrees of Correctness
  10. • Immutable reference to immutable data • Immutable ref. to

    mutable data • Mutable references to… • Raw pointers to… Degrees of Correctness
  11. • Immutable reference to immutable data • Immutable ref. to

    mutable data • Mutable references to… • Raw pointers to… • Reference-counted pointers to… Degrees of Correctness
  12. • Immutable reference to immutable data • Immutable ref. to

    mutable data • Mutable references to… • Raw pointers to… • Reference-counted pointers to… Degrees of Correctness
  13. • Compiler-enforced immutability • Compiler-enforced memory management • Compiler-enforced thread

    safety • unsafe, aka “I just want to write C and Assembly” Kinds of Correctness
  14. Helpful Community • There is NO “You should know this”

    or “RTFM” • Everyone understands that learning Rust can be tough • Formal structures in place (CoC, etc)
  15. Disadvantages • It is frustrating!! When the compiler rejects code,

    it’s not always obvious why there’s a problem.
  16. Disadvantages • Choose between ALL of the metaprogramming (write your

    own AST), or only a tiny bit (restricted macros)
  17. Why do I think you should use Rust? • Learning

    about how computers work underneath
  18. Why do I think you should use Rust? • Learning

    about how computers work underneath • Want to write fast code – approaching hardware limits – and don’t want to write C
  19. Why do I think you should use Rust? • Learning

    about how computers work underneath • Want to write fast code – approaching hardware limits – and don’t want to write C • Hate pthreads
  20. Why do I think you should use Rust? • Learning

    about how computers work underneath • Want to write fast code – approaching hardware limits – and don’t want to write C • Hate pthreads • Don’t like race conditions in your concurrent code
  21. Why do I think you should use Rust? • Learning

    about how computers work underneath • Want to write fast code – approaching hardware limits – and don’t want to write C • Hate pthreads • Don’t like race conditions in your concurrent code • Don’t want segfaults and buffer overflows
  22. Why do I think you should use Rust? “A language

    that doesn’t affect the way you think about programming is not worth knowing” I think Rust will change how you think about correctness.
  23. Stages of Life • Pycniospores - Haploid (half-chromosome) gametes •

    Aeciospores - non-repeating (can’t force a host to reinfect itself) dikaryotic (two different nuclei in a cell) vegetative spores • Urediniospores - repeating dikaryotic vegetative spores. • Teliospores - Diploid spores that produce basidia (fruiting bodies) • Basidiospores - Haploid spores which infect an alternate host.