Why is it called Rust?
It is named after a
family of fungus
Slide 4
Slide 4 text
Why is it called Rust?
They are NEAT
Slide 5
Slide 5 text
Why is it called Rust?
They have *five* stages
of life (humans only
have two) that they can
move back and forth
between
Slide 6
Slide 6 text
Why is it called Rust?
Concurrent, distributed
organism
Slide 7
Slide 7 text
Why is it called Rust?
Nearly unkillable (just
ask my favorite camellia
trees)
Slide 8
Slide 8 text
Goals of Rust:
• Concurrent
• Unkillable
Slide 9
Slide 9 text
Goals of Rust:
Can we do that while
managing the computer’s
memory directly?
Slide 10
Slide 10 text
Goals of Rust:
Can we do that while
managing the computer’s
memory directly?
YES!
Slide 11
Slide 11 text
Goals of Rust:
Can we do that while
managing the computer’s
memory directly?
YES! (yay language research!)
Slide 12
Slide 12 text
Ideology
How does Rust think people
should program?
Slide 13
Slide 13 text
Ideology
Pay the frustration costs up
front!
Slide 14
Slide 14 text
Frustration
Very strict compiler errors –
even confusing ones – are
betting than debugging
Slide 15
Slide 15 text
Frustration
(I like that this mirrors the
philosophy of TDD)
Slide 16
Slide 16 text
Frustration
Rejecting possibly correct
code is better than allowing
incorrect code
Slide 17
Slide 17 text
Safety vs Inconvenience
A spectrum!
(extra programmer time, learning)
Proven correct
before run
Only runtime errors
(all errors are logic errors)
Slide 18
Slide 18 text
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
Slide 19
Slide 19 text
Safety vs Inconvenience
Where does Rust live?
(extra programmer time, learning)
Slide 20
Slide 20 text
Safety vs Inconvenience
(extra programmer time, learning)
Machine code
Slide 21
Slide 21 text
Safety vs Inconvenience
(extra programmer time, learning)
Machine code
LISP
(1958 version)
Slide 22
Slide 22 text
Safety vs Inconvenience
(extra programmer time, learning)
Machine code C
LISP
Slide 23
Slide 23 text
Safety vs Inconvenience
(extra programmer time, learning)
Machine code C
LISP Ruby
Slide 24
Slide 24 text
Safety vs Inconvenience
(extra programmer time, learning)
Machine code C Rust
LISP Ruby
Slide 25
Slide 25 text
Safety vs Inconvenience
• More annoying than Ruby
(extra programmer time, learning)
Machine code C Rust
LISP Ruby
Slide 26
Slide 26 text
Safety vs Inconvenience
• More annoying than Ruby
• Fewer errors allowed
(extra programmer time, learning)
Machine code C Rust
LISP Ruby
Slide 27
Slide 27 text
Safety vs Inconvenience
Rust has a range of
correctness!
(extra programmer time, learning)
Slide 28
Slide 28 text
Rust and Correctness
Address
Machine Word
Byte
Slide 29
Slide 29 text
Rust and Correctness
None of these
are checked!
Slide 30
Slide 30 text
Rust and Correctness
“Urgh”, I thought
Slide 31
Slide 31 text
Rust and Correctness
On the other hand, that’s how you
crash your Mars Climate Orbiter.
Slide 32
Slide 32 text
Degrees of Correctness
• Immutable reference to immutable data
Default:
Compiler-enforced!
Slide 33
Slide 33 text
• Immutable reference to immutable data
• Immutable ref. to mutable data
Degrees of Correctness
Slide 34
Slide 34 text
• Immutable reference to immutable data
• Immutable ref. to mutable data
• Mutable references to…
Degrees of Correctness
Slide 35
Slide 35 text
• Immutable reference to immutable data
• Immutable ref. to mutable data
• Mutable references to…
• Raw pointers to…
Degrees of Correctness
Slide 36
Slide 36 text
• Immutable reference to immutable data
• Immutable ref. to mutable data
• Mutable references to…
• Raw pointers to…
• Reference-counted pointers to…
Degrees of Correctness
Slide 37
Slide 37 text
• Immutable reference to immutable data
• Immutable ref. to mutable data
• Mutable references to…
• Raw pointers to…
• Reference-counted pointers to…
Degrees of Correctness
Slide 38
Slide 38 text
• Compiler-enforced immutability
Kinds of Correctness
Slide 39
Slide 39 text
• Compiler-enforced immutability
• Compiler-enforced memory management
Kinds of Correctness
• Compiler-enforced immutability
• Compiler-enforced memory management
• Compiler-enforced thread safety
• unsafe, aka “I just want to write C and
Assembly”
Kinds of Correctness
Slide 42
Slide 42 text
Memory safety!
Slide 43
Slide 43 text
AMAZING error messages
How… did you know?
Slide 44
Slide 44 text
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)
Slide 45
Slide 45 text
Disadvantages
That all sounds pretty great.
What are the trade-offs?
Slide 46
Slide 46 text
Disadvantages
• It is frustrating!! When the
compiler rejects code, it’s not
always obvious why there’s a
problem.
Slide 47
Slide 47 text
Disadvantages
• Choose between ALL of the
metaprogramming (write your
own AST), or only a tiny bit
(restricted macros)
Slide 48
Slide 48 text
Disadvantages
Slide 49
Slide 49 text
Disadvantages
• Emphasis on compile-time
correctness – test support is
pretty minimal
Slide 50
Slide 50 text
Why do I think you should
use Rust?
• Learning about how computers work underneath
Slide 51
Slide 51 text
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
Slide 52
Slide 52 text
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
Slide 53
Slide 53 text
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
Slide 54
Slide 54 text
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
Slide 55
Slide 55 text
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.
Slide 56
Slide 56 text
Thanks~
@lito_nico
Slide 57
Slide 57 text
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.