►
Description
Matthew Fluet talks about the experience of teaching Rust for two semesters, relating accrued positive, neutral, and negative learnings. Fluet describes and evaluates five programming assignments used: a mini-language interpreter; a puzzle solver; a trie library; a parallel evaluator for elementary cellular automata; and an asynchronous networked Rock-Paper-Scissors server.
A
Right
so
I'd
like
to
tell
you
a
little
bit
about
the
two
semesters:
I've
spent
teaching
rust
just
a
little
bit
background
at
my
institution,
rochester
institute
of
technology,
we've
had
a
series
of
co-listed
bachelor's
master's
courses
that
were
really
set
up
to
hey,
let's
introduce
a
new
language
or
new
language
paradigm,
and
so
we've
had
regularly
offered
instances
on
haskell
on
modern
c,
plus
on
c
sharp.
So
over
the
past
two
years
you
know
I've
been
doing
an
instance
of
this
course.
A
You
know
on
rust
and
overall,
the
experience
has
been
quite
positive.
I'm
thinking
that's
been
the
experience
of
most
of
us
here,
maybe
in
a
little
contrast
to
rosa's.
You
know,
intro
sequence.
My
course
yo
is
sort
of
a
best
case
scenario
for
teaching
rust
in
terms
of
prior
experience.
My
undergrads
are
definitely
through
their
entire
intro
sequence,
with
pyth
semesters
of
python,
java
and
c
plus,
at
least
our
undergraduate
pl
course
that
you
know
kind
of
surveys
things
and
for
our
masters,
students
they've
definitely
had
you
know.
A
So
what
I
was
hoping
to
spend
today
doing
is
telling
you
a
little
bit
about
my
course
structure
a
little
bit
about
my
favorite
lectures
that
that
came
out
pretty
well
and
invite
you
to
borrow
materials
and
a
little
bit
about
the
programming
assignments
that
I
put
a
lot
of
effort
into,
because
I
think
that's
really
the
place
where
students
are
going
to
get
the
most
out
of
the
course,
and
you
can
see
the
paper
that
I
wrote
up
for
a
qualitative
comparison
with
the
haskell
version.
A
The
course
that
I
have
taught
many
times,
because
I
think
it's
it's
an
interesting
point
of
comparison
of
those
two
languages
and
language
communities
too,
especially
so
we've
got
a
traditional
15-week
semester.
A
The
way
I've
set
up
this
course
is
about
the
first
half
spends
time
following
the
rush
programming
language
book,
pretty
yo
directly
with
some,
you
know,
lectures
and
sort
of
for
the
second
half
we
kind
of
transitioned
to
less
polished.
You
know
primary
source
material.
A
You
know
we're
going
to
blogs
and
videos
and
some
research
papers,
but
trying
to
address
you
a
lot
of
different
kinds
of
advanced
your
topics
and,
of
course,
that's
the
kind
of
thing
that
can
evolve
over
time
as
things
come
and
go
out
of
that
realm.
A
Something
that
worked
particularly
well
for
for
this
course
was
to
include
some
preparation
work.
You
know,
reading
ahead
of
time
with
some
pass,
you
know
failed
done,
not
done
quiz
that
kind
of
got
our
our
discussion
started.
So
I
got
them
critically
thinking
ahead
of
time
and
we
could
sort
of
dive
into
that.
A
You
know
during
lecture
I'll,
tell
you
a
little
bit
about
you
know
my
programming
assignments
and
then
the
other
interesting
things
that
I
have
them
do
is
try
their
hand
at
designing
you,
a
new
programming,
your
assignment
for
that
first
half
of
the
course
of
teaching
a
course.
For
the
first
time
I
didn't
have
a
lot
of
assignments
ready
at
hand,
so
that
was
a
good
thing
to
ask
students
to
do
and
another
activity.
A
I
asked
them
to
to
go
out
and
look
at
some
of
those
advanced
topics
that
we
didn't
get
a
chance
to
in
class
and
investigate
them
on
their
own
and
share
that
in
sort
of
a
blog
post
to
the
rest
of
the
the
course
there's,
also
an
independent
team
project
that
students
do
mixed
bag,
probably
the
best
one
that
that
came
out
was
one
pair
of
students
that
did
an
ll1,
parser,
generator
and
rust.
A
But
otherwise
you
know
we
got
sort
of
the
traditional
mix
of
games
and
you
know,
interpreters
and,
and
that
kind
of
thing
so
a
little
bit
about
your
lectures.
The.
A
Crucial
yo
collegiate,
fair
yo
discussions,
q,
a
you,
know,
white
board
and
stuff,
so
nothing
terribly
innovative
there.
But
I
want
to
tell
you
about
three
lectures
that
that
works.
You
know
particularly
well
or
I
think
that
fill
in
some
gaps.
You
know
that
are
out
there
in
the
resources
that
I
at
least
was
was
using
the
course
so
the
first
was
on
implementing
iterators
and
I
think
this
was
a
piece
that
changed
significantly
from
the
first
time.
A
I
taught
the
course
to
the
second,
because
in
the
first
time
I
taught
the
course
I
had
sort
of
deployed
the
assignment.
You
know
where
they
were
asked
to
implement
an
iterator
for
a
data
structure
and
people
just
could
not
do
it
and
I
realized
it's
because
we
did
not
actually
look
at
one.
You
know
deeply
in
class
and
looking
back
at
some
of
the
source
material.
A
The
simple
counter
example:
that's
out
there
in
the
book
in
the
standard
library
on
documentation,
it's
really
too
trivial
for
people
to
know
how
to
build
it
up
yo
themselves.
So
we
go
through
this
exercise
now
of
implement.
You
know
an
iterator
on
a
simple.
A
You
know
triple
data
structure,
but
at
least
gets
them
seeing
hey
there's
this
thing
that
works
well
for
the
immutable
borrowing
iterator,
but
fails
for
the
mutable,
borrow
iterator
and
fails
for
the
ownership
transfer
iterator,
and
we
kind
of
build
that
up
over
time
to
to
see
how
to
transition
from
the
simple
example
to
something
that
works
more
broadly.
A
And
then
we
also
back
that
up
with
you
know,
implementing
a
pre-order,
tr
iterator
for
simple
binary
yo
tree,
where
they
kind
of
have
to
do
that
mental
transition
from
well.
I
used
to
do
a
traversal
just
with
recursion
and
an
implicit
call
stack
now.
I
need
an
explicit
stack
in
the
reiterator
state
and
we
and
now,
with
that
lecture
in
hand,
they
were
able
to
go
on
and
do
the
actual
implement
your
own
iterator
exercise.
A
Much
more
simply
another
one
that
that
worked
out
particularly
well
was
sort
of
following
up
on
the
the
fearless
concurrency
for
many
students
right.
This
will
be
the
first
time
that
they've
seen
message
passing
as
a
concurrency
mechanism,
they're
kind
of
used
to
shared
state,
and
they
kind
of
you
know
a
little
about
mutexes
and
stuff,
but
seeing
channels
is
new
to
many
of
them,
so
we
implement
this
broadcast
channel
abstraction.
You
know
so
essentially,
multiple
senders,
multiple
receivers,
but
ascend
is
broadcast
to
all
the
registered
receivers
and
that
gets
us.
A
You
know
using
both
channels,
but
also
atomic
reference,
counting
in
mutexes
behind
the
scenes
we
talk
about.
What
do
we
want
to
happen
when
a
receiver,
you
know
goes
away?
How
do
we
prevent
from
constantly
broadcasting
to
somebody
who's?
Not
there
anymore,
get
to
observe
that
we
don't
need
to
do
anything
special
on
drops.
A
We
can
handle
the
disappearance
of
senders
or
receivers.
You
know
in
the
the
send
and
receive
methods,
and
one
interesting
thing
yo
that
that
gets
a
number
of
the
students
is
that
we
finish
all
this
and
we've
done
all
this
message
passing
and
then
we
look
at
our
code
and
we
see
that
there's
no
send
bounds
anywhere
and
getting
to
understand
like.
A
Why
is
it
that
within
the
channel
we
don't
need
this,
but
rather
it
gets
impressed
upon
the
channel
when
it's
actually
shared
between
threads,
but
not
in
the
channel
abstraction
itself,
which
is
an
interesting
thing
for
for
many
students
to
see,
and
so
the
last
deal
lecture
that
that
worked
out,
particularly
well
with
something
kind
of
going
after
unsafe
rust,
because
we
kind
of
hint
at
that
a
lot
through
the
course
and
and
people
are
interested
in
seeing
unsafe,
rust
sort
of
in
action.
A
So
we
implement
this,
I
call
it
a
gallery
abstraction,
it's
a
place
to
which
you
can
donate
objects,
after
which
you
lots
of
people
can
look
at
that
object,
but
nobody
can
touch
it
right.
So
you
get
back
a
reference
to
that
object,
but
nobody
can
mutate.
It
anymore.
This
turns
out
to
be
a
very
simplified
version
of
the
typed
arena,
crate
if
you're
familiar
with
that
and
so
in
the
lecture
yeah.
A
What
we're
able
to
do
is
refine
it
from
you
know
the
very
s
you
know
a
simple
version
of
just
having
you
know
a
vector
of
objects
to
a
more
complicated
one
that
handles
various
levels
of
indirection
and
knowing
exactly
when
we
need
to
do
a
particular
unsafe
cast
to
get
our
lifetimes
to
work
out
and
along
the
way,
I'm
able
to
introduce
and
use
the
miri
tool
you
know
for
checking
for
undefined
behavior
and
that
kind
of
yo.
We
were
able
to
say
well,
look
it's
sex
faulted
here.
A
You
know
dive
deeper
okay,
so
you
know
I
won't
probably
have
time
to
go
through
all
of
these
assignments,
so
in
detail
here,
there's
a
lot
of
details
in
the
papers
that
I
put
together,
but
I
put
a
lot
of
effort
into
the
the
programming
assignments
because,
honestly,
you
know
how
do
you
learn
to
program?
You
know
you
actually
program,
you
can't
just
sit
there
and
lecture
and
get
it,
and
one
of
the
things
that
I
found
interesting
in
putting
these
together
is
that
I
found
myself
very
easily.
A
Adding
in
these
optional
didn't
make
them
extra
credit,
they're,
just
so
optional
challenges
at
the
end
and
usually
they're
asking
the
students
to
either
implement
some
kind
of
advanced
functionality
or
improve
the
efficiency
of
a
component
or
invitations
to
return
back
to
this
assignment
after
we've
seen
some
advanced
feature
that
comes
later
in
the
course
where
now
they
can
incorporate
that
into
it,
and
I
think
this
is
very
much
in
the
style
of
rust.
I
think
rust
really
does
emphasize
its
ability
to
start
with
something
simple
and
then
refine
it
over
time.
A
You
know
with
both
advanced
features,
but
also
the
safety
that
we're
getting
from.
You
know
those
guard
rails.
That
bart
you
know
mentioned
up
front.
You
know
so
that
you
know
you've
got
something
that
works
and
you
go
to
try
to
make
it
better.
You
know
you're,
not
breaking
it.
You
know
in
a
particularly
bad
way.
A
So
I'll
be
really
brief
to
to
focus
on
a
couple
of
these
and
really
yo,
I'm
here
to
invite
you
to
steal
these
and
borrow
these
and
tell
me
what
you
think
about
them.
So
one
of
our
early
assignments
is
to
implement
a
simple
stack
based
interpreter
for
this
little
stack
based
mini
language
called
you
know,
birch
completely
made
made
up.
You
know
and
they're
getting
some
experience.
You
know
dealing
with
traits
and
managing
ownership.
A
You
know
simple,
you
know
moving
data
in
and
out
of
these
stacks
and
they
can
see
some
of
the
overhead
of
duplicate
duplication
that
hopefully
helps
them
to
understand.
You
know
the
idea
of
pushing
things
off
in
helper
methods
and
using
things
like
error
propagation.
So
the
example
here
kind
of
emphasizes.
Look
for
my
add
subtract
multiply,
divide
your
operations,
all
of
the
need
to
pop
two
numbers
off
the
stack
and
it's
going
to
be
an
error.
A
If
either
of
the
top
two
elements
aren't
numbers
you
know
or
if
there
aren't
top
two
elements,
so
we
move
that
off
into
you,
know
a
helper
method.
Do
the
error
propagation,
you
know
to
kill
off
our.
You
know
our
execution,
one
of
the
challenges
that
asks
them
to
come
back
later,
because
we
haven't
seen
closures
yet
is
to
come
back
to
after
we've
seen
closures.
So,
for
instance,
you
know,
add
subtract,
multiply
and
divide.
We
really
want
to
pass
in
the
the
higher
order
function.
A
You
know
pass
in
the
the
function
that
says:
here's
the
arithmetic
operation
that
I
want
you
to
do.
Another
interesting
thing.
That
again,
I
think,
emphasizes
rust
is
that
we
can
change
our
data
structure
to
really
reduce
you
know
allocations.
I
don't
have
time
to
go
into
the
details
here,
but
you
know
with
a
simple
shift
of
going
from
owned
vectors
of
commands
to
slices.
You
were
able
to
reduce
the
allocation
of
the
the
interpreter
by
your
orders
of
magnitude.
A
Another
interesting
one
is,
this
doing
backtracking.
Sorry,
actually
not
backtracking.
It's
using
breadth-first
search
with
hashing,
so
it's
not
using.
You
know
backtracking
solving
simple
puzzles,
so
we
introduce
you
a
puzzle
trait
to
represent.
You
know
the
state
of
a
puzzle
and
how
you
can
evolve
that
state
practice
you're
using
some
of
our
data
structures
to
you,
know,
implement
the
the
solver
and
then
some
of
the
challenges
that
that
can
be
there.
A
We
have
one
on
using
tries
that
symbol
mapping
from
from
strings
to
values,
so
this
is
the
one
that
asks
them
to
implement
an
iterator
over
this.
Yes
or
now
generalized.
You
know
tree-like
structure
and
there's
some
interesting
things
that
come
up
with
them:
understanding
how
to
manipulate
this
data
structure,
how
to
implement
the
iterators
on
it.
A
For
some
of
the
simple
operations,
I
asked
them
to
think
about
what
happens
when
you
implement
this
with
iteration
versus
what,
when
you
implement
this
with
recursion
there's
some
interesting
behaviors,
where,
when
you
make
a
recursive
call
you're
sort
of
getting
some
borrow
checking,
you
know
a
borrow
and
a
return
of
that
borrow
automatically
from
that
recursive
call
that
you
don't
always
get
you
know
if
you
do
it
with
you
know,
in
sort
of
in
place,
you
know
looping
iterator,
and
this
one
has
a
lot
of
sort
of
challenges
that
you
can
think
of
in
terms
of
trying
to
minimize
allocations
again
us
going
from
a
simple.
A
A
A
You
know
their
overheads
with
some
challenges
going
out
there
and
using
things
like
rayon,
which
is
a
data,
parallelism
library,
crate
and
and
seeing
how
that
works
and
a
final
exercise
yo
on
rock
paper
scissors
game
server,
getting
them
exposure
to
async
await
and
your
game
servers.
You'll
have
all
these.
You
know
moving
parts
you
know
and
they're
sort
of
a
perfect
example
of
where
you'd
like
to
use
async
operations.
A
Rock
paper
servers
is
lucky
is
that
they
don't
get
lost
in
the
game.
Logic
right
and
one
interesting
thing
from
an
instructor's
point
of
view-
is
how
do
you
test
this
testing?
A
You
know
asynchronous
things
is
pretty
tough,
so
I
put
together
a
test
mode
that
simulates
a
whole
bunch
of
players,
monitors
the
input
output
for
conformance
with
the
specification,
and
so
that's
able
to
sort
of
you
know
help
us.
The
students
see.
What's
going
on
so,
like
I
said,
I'm
really
happy
to
share
these
things
with
the
the
community
and
see
you
know
what
people
have
to
to
think
about
that
and
let
me
pull
up
my
you
know
chat
window
now,
because
I
have
that
behind
the
screen.
A
Yeah
large
projects-
I
think
it's
interesting
yo
with
respect
to
this
workshop
I'll
admit
that
I
have
not
seen
as
impressive
projects
from
students.
You
know
that
this
sort
of
final
team
project,
as
I
might
have
hoped
again
and
I've
given
them.
You
know
full.
You
know,
15
weeks
of
learning,
you
know
rust,
and
so
with
respect
to
some
of
these
ideas
of
embedding
rust
in
other
courses,
you
know
the
operating
systems
course
or
the
compilers
yo
course,
at
least
from
my
observation.
A
A
A
Things
that
have
go
yo
rayon
we
get
speed
up.
I
mean
we
because
I'm
I'm
really
just
asking
students
to
do
on
their
own.
You
know
machines,
we're
getting
you
know
around.
You
know
two
and
a
half.
You
know
x
speed
up
on
four
cores.
It
doesn't
scale
too
much
more
beyond
that,
like
I
said,
the
the
overheads
and
there's
some
necessary
synchronizations.
A
You
know
that
that
prevent
us
from
getting
too
much.
You
know
beyond
that.
What
has
gone
less
well,
so
you
know
the
things
that
haven't
gone
great
is
yeah.
I
don't
have
any
silver
bullet
for
teaching
ownership,
it's
just
something
that
I
feel
like.
We
have
to
come
back
to
over
and
over
again
through
the
course
and
kind
of
emphasize
you
know
where
it
arises
again,
especially
in
api
design.
I
think
that's
the
place.
I
emphasize
a
lot.
A
I
didn't
really
get
a
chance
to
put
it
back
in
the
slides
you
know
or
back
into
the
paper,
but
one
other
thing
that
does
sometimes
get
me
teaching.
The
language
is
that,
well,
there
are
a
lot
of
great
ergonomic
decisions,
yo
in
rust
to
make
things
simpler
or
make
common
cases.
It
sometimes
hides.
You
know
a
bit
of
what's
going
on
behind
the
scenes
and
you
know
initially
that's
what
students
need
to
see.
I've
occasionally
wished
that
I
could
sort
of
turn
off
some
of
these.
A
You
know
ergonomic
decisions
so
that
they
were
forced
to
write
out
the
more
verbose
thing
and
because
it's
very
easy
to
go
far
thinking
that
you've
got
one
understanding,
because
that's
the
syntax,
that's
constantly
being
accepted,
but
it's
really
hiding
something
yo
going
on
behind
the
scenes,
particularly
with
yo,
know
max
mentioned
lifetime
a
lesion.
A
The
other
thing
that
I
find
really
hard
to
do
is,
for
whatever
reasons,
ownership
as
a
static
analysis
seems
to
be
characterized
more
by
what
it
doesn't
accept,
then,
by
what
it
does
accept,
whereas
I
think
you
know
with
our
type
systems,
you're
kind
of
like
oh
yeah.
I
want
to
accept
that.
I
want
to
accept
that,
and
so,
whenever
I'm
showing
even
you
know
other
code,
you
know
examples
tutorials,
it's
constantly
code
littered
with
well.
If
you
can
uncomment
the
following
line,
you'll
get
this
error
and
that's
never
checked
and
yeah.