The History of Rust


ready for hey ok so I second talk of the day as I
mentioned before Steve Klabnik up talking about the history of rust so
without further ado hi everybody I’m Steve thank you so much
for having me here this is definitely honor and I’m extremely excited to give
this talk i work on the rest project at Mozilla but before that i was involved
in rust as an open source capacity I actually wrote the first community
tutorial like the first tutorial for us outside of Mozilla like three years ago
and eventually turned that into now it is my job to write the tutorials for us
so I work on all the documentation but one thing that is very very interesting
about rust is because of Mozilla’s open source DNA rust is a programming
language they had an extremely long period of development in public before
it was really ready to be used by a industry and so that history is actually
very long and I wanted to give you some of this backstory to sort of summarize
the history of breast development so that we can remember it you know in five
years once we’ve had two days rest and so this is a talk largely about trust history so a just a brief bit about the
language itself Russell a programming language we have
been developing it for I like to say almost 10 years that will
talk about . ization but basically basically a eight and a half – 10 years
we had our one . no release on May of last year so it’s been about a year
since one point out and one point I was the part where stuff sort of stopped
changing and so I want to talk about that pre . the the one year since one
point out and a little teeny bit about rest future I’m not going to talk a whole lot more
about rust itself first I want to discuss like why you
should care about the history even if you don’t you know know that much about the
language so let’s talk about stories so this is like a story of rust stories
need to have some kind of narrative to sort of drive them forward and so I’m i
particularly like to think of this kind of history of being divided into epics
so and an epic you know is a little bit of a fuzzy kind of term because it’s not
necessarily about this date till this date it’s about what is the predominant sort
of like theory at the time or what is the predominant paradigm that is going
on at this particular time period and so as things goes on and times change we sort of move into a different epic
and so r us has had four sort of epochs in its story so far and we’re kind of
just entering a new one like two or three weeks into the for the next one
and so I I sort of gave these names to kind of help because saying dates all
the time is kind of you know annoying so 2006 – 2010 are the personal years 2010
2 2012 or the grading years twenty twelve to fourteen is the type system
years and then there was the release year from 2015 till May of this year and
so now i’m calling this new era the production year we’ll see if in a year
or two from now that’s like a dumb name you can’t necessarily predict the future
but i think that this is what is going to sort of dominate rust in the near
future so moving between epics this is a quote I’m sorry this is kind
of small what is interesting about my presentation is it actually generated by
the rust documentation tool which is really cool but it also means that
sometimes the text is a little tiny uh well um this quote says it took a
long time to figure out how r us ought to work this is nico maracas one of the core
team members of rust and so the reason that rust had this sort of complicated
history or these four different periods is because we always sort of knew what
we wanted rust to be but we didn’t know how to make it what we wanted it to be and so it was this like research
development effort to sort of figure out how to go and achieve our goals and that
changed significantly over history so i like to call this
empirical iteration so if you look at rust on this on like a feature basis
like what features of the language have its pretty much being these four
different languages over these four different time periods but if you look
at our mission statement it has always been the same since the
beginning and so that sort of happens because of this understanding and
research that we did about how to achieve our goals and you know whenever
you learn new things you should revise what you’re doing right that’s sort of a
core scientific principle however the eight years that led up to the release
of one point out is also an extremely long period of time so we have a lot of
ground to cover and we learned a lot over this history so another aspect of this iteration like
I make reference to empiricism so like how are we empirical about developing
rest on the first thing that we did was to rewrite the rest compiler in rust
itself the original of us compiler was written no camel talk about that in a minute but
we bootstrapped relatively early and we thought this was important to sort of
test out the language itself however one danger with this approach is that you
might end up developing a programming language that’s really good at building
compilers since that’s your main you know thing you’re doing with it so a is an effort to not do that and
also to sort of prove it out a in worth to Mozilla at the same time we also
started the servo project which is a rewrite of gecko the rendering engine
that drives firefox so we sort of had these two different large code bases to
work with rust on and while you know it’s not totally like
the projects are completely separate a lot of people that contribute to one
also contribute to the other a little bit there’s a number of people who work
pretty much only on the language itself and a number of people that work pretty
much only on servo and so it even you know Michelle is a
large enough organization that these groups we are kind of like relatively
separate and so it’s kind of like working with different teams are working
with this entire separate project and so what would happen was we would on the
rest team we would develop some kind of new feature and we put it in the
language and then servo would start using it and they would tell us like oh
this feature works really well for this feature doesn’t work really well or here’s our tweaks and if the project
if the particular feature was good we would keep it and it was bad we would
throw it out or revise it in some way and so this process kind of back and
forth turned and turned and turned and turned and we just did this for a really
long time to sort of figure out you know it’s kind of like having a really sharp
stone and just running water over it until everything is smooth sometimes the stone goes away entirely
need to get a new stone huh so I like say that rust has lost more
features than many languages even had in the first place like if you pick a random . and rest
history it seems like a completely and totally different language it’s also important before rust came out
a lot of people look to this process from the outside and said clearly the
rest team has no idea what they’re doing they keep trying things out and throw
them away and so it’s not about having an identity
crisis it’s again it’s about research like this
is fundamentally a research project and so we’ve always had this goal and you
know that’s important ok so to review for epics personal years great in years type system years and the
release year now i’m going to get into some history
from each of these different time periods so the personal years these are some quotes from the very
first time that great Whore the original inventor of rust announced the project
to the world so i have been writing a compiled
concurrent safe systems programming language for the past four and a half
years we do not know what exactly will come of
it many older languages are actually better than newer languages and we keep
forgetting already learned lessons and he described dressed as technology from
the past come to save the future from itself that was an awesome excellent sentence
and so this is sort of like what i mean by we’ve always had the same goal you will find almost the exact same
language used to describe rest today that first sentence compiled concurrent
safe systems programming language if you go to rust line . or today you
will find a rusted systems programming language that is focused on safety speed
and concurrency so like the safety systems stuff was and concurrency you’re
all you know there it’s the same language so it’s
especially interesting that it was completely different and so I call these
the personal years because again this was great and had announced like he was
developing this in his spare time so here’s some old syntax I have a bunch
of slides with syntax that doesn’t exist anymore just like show you a little bit of how
the language has changed and so this was the basically the first rest code that
was ever shown to the world like outside of graton so we have a log key word that
can print things to the screen we still have this like FN a style like
function declaration but the types are before the variables kind of like see so
we have two integers returns another integer isn’t if you notice red x + ret
why originally grade and had a rule that key
words could not be longer than five characters maximum so early rust was
extremely tourists and that was one of the things that in some instances we
have slowly relaxed but in some instances we’ve not so for example we
still have FFN but Brett is now return because that makes sense in the early development this was a
really good thing but you know like different people have different opinions
rust used to have explicit object orientation so we declare an object with
the object keyword because again it’s to look still needs to be short and has one
instance variable and integer I that you know the state and so we have
like a member functions to increment and return the value of that state and then
down here in Maine we create a new counter and started off at 10 you notice
the auto key words you type inference so early rust still had a lot of type inference
and we can call increments and then print out you know get so rust is not
actually strictly speaking have object oriented stuff anymore well it kind of does like I i like to
see the rest does not have 0 because i don’t think that it satisfies either of
the two sort of major forms ofOctoberin my opinion so we
definitely do not have Alan kaizo oh and we don’t really have java Zoe there so
rust might have 0 depending on your opinion of what the definition of Hopi
like even is what we had explicitly before here’s a function that uh with generics
so early rest had generics it use the square brackets to indicate type
parameters so this function swap takes one type parameter T and a tuple of two
teas and returns a tuple of 2 t’s by swapping their inner values because the
underscore one and underscore 0 or the indexing syntax to access the elements
of the tuple and so we can make a string pair and an integer pair and swap them
by you know explicitly passing in these type parameters and so this was kind of
the you know generics back then one of the things that great and said
that I think is is really important because sometimes be taken out of
context is the semantics is the interesting part the syntax is really about the last
concern and I think that when you’re researching a language and you’re
figuring it out this is really really important there’s
sort of this law in the the high school community which I think that it
swaddlers law but i cannot remember the name of top of my head but basically it
says like the further you go down this list the more people will argue about it
and it’s semantics syntax lexical syntax lexical syntax of comments and so people
get really really really like hung up on syntax when they look at a language but
if your language designer uh I think that while you’re figuring
your language out you should not worry about syntax it is however important later so for
example once we had gotten rust to the state where we liked our semantics we did an intense evaluation of all of
our syntax to make it like acceptable to people so
sometimes we’ll put this quote and be like the rest designers don’t care about
some tax at all and like that’s not really true we didn’t care before and we care very
much now because times change but so there was this also meant that because
rust is written and rust when you’re changing the syntax of the
language on a daily basis in the project that is written inside of it you accumulate technical debt and we’ll
talk about that later here are some other descriptions that
great and gave of the rest language back then so memory safety no wild pointers
the type state system no null pointers this was a PLT research
thing called type state that we had in rust and we ended up actually removing
because it was not actually useful but it was pitched is like one of the
original reasons to use rust was like finally a language that implemented type
state mutability control immutable by default side effect control pure by
default rust does not have the concept of purity
at all anymore you can break the rules but you have to
authorize where and how in a standard way that’s integrated the language and
easy to audit this is still completely true today and
retains its original form which is the unsafe keyword so in a systems
programming language you do not have the luxury of being able
to tell your users that they have to do something your way or you don’t have the
luxury of pretending that the machine is not what the Machine actually is so we
have the gun safety word that allows you to sort of break out of the rules that
we have constructed because like fundamentally the Machine definitely is
not immutable by default and the Machine you know definitely has no pointers and
you know things like this well you know depending on your
perspective and so you know this is really really important to the language
multi-paradigm definitely not everything is an object and different abstractions
for different problems trade-offs between control expression clarity and
brevity and this kind of relates to what I was
just talking about like you can’t say everything needs to be fully objects
because like what if it doesn’t you know it just depends I’ve been I have a little hobby
operating system project were working on in rust and I just converted my
interrupt table from assembly to like actual rest code and I appreciated this
you know in that moment because you need these explicit bits need to be set and
put it exactly this location in memory and like you know your CPU does not care
if you’re you know but everything needs to be an object doesn’t happen so at this point uh you know after four years of personal
development of great an estimated that about ninety percent of the language
features were working in rough form again remember there’s like five years
of history after this time . seventy percent of the runtime is working and
it’s a thirty-eight thousand line of code o camel compiler and so actually
this original . actually thinks looks extremely similar to what go is today
other than you know now go is written and go but we sort of had this runtime
this this edition of rust actually had a garbage collector because we assumed
that you need a garbage collector for memory safety I have some upcoming code to show you
channels which i think is happening soon but channels were in the language
because we thought you needed them to to need them to be in the language have to
be safe i’m skipping ahead so after this sort of
what I call a personal years the next year’s and the ones that have at least
slide on our the great in years and so rust was now adopted by Mozilla so again
this servo project fundamentally why mozilla cares about rust is that firefox
is written about four and a half million lines of C++ code and if you look at the
extreme security vulnerabilities and firefox like the ones that say if you go
to the wrong web page they run arbitrary code on your machine kind of like
extreme security vulnerabilities about fifty percent of them boil down to the
fact that C++ is a very sharp tool and even when you have you know incredibly
distinguished engineers have been working you know even on the same
project for over a decade humans are still fundamentally fallible
and so you make a mistake and then you pay the costs so part of why Mozilla’s interested in rust is can we
eliminate those human mistakes through a compiler like compilers never sleep compilers don’t get tired compilers
always hopefully you know do the right thing obviously compilers also have bugs
so that statement is like kind of false in some sense but you know the idea is
to reduce these kinds of problems and so uh so rusted and been adopted by Mozilla
grading was a mozilla employee and so basically this was his personal project
that got brought into missoula proper and grain was a benevolent benevolent
dictator for life style figure in the development of rest during this time .
so there was this particularly steady rate of improvement and change the
language and the team would slowly grow so originally there are only great and
one or two other employees on rust and then slowly as you know the project grew
mozilla allocated more people start working on rust and so development
accelerated when you go from one developer to for developers you know you
get a lot more done obviously not four times but like you
know it helps so a that time period was also not super
particularly interesting which is why I’ll have one slide on it because it was
like we did some work and slowly work through a lot of issues but as the team
grew one of the things that happened was we brought more people had more
experience with more advanced type systems so like people that had phd’s in
type systems research and so naturally the language grew a better and better
type system and one side effect of this that I alluded to earlier was that as
the type system grew more and more stuff moved out of the language proper and
into libraries so as I mentioned for example we thought that we needed a
garbage collector – I’m deal with memory safety it turns out
we can do that entirely through the type system and eliminate the GC entirely we thought that channels needed to be in
the language in order to be safe it turns out that that’s not actually
true you can make channel safe through the type system and then move them into
the library so rust sort of as a package to the end user it didn’t really lose a
lot of features like rust still has channels today but the difference is is
that because they’re in libraries other people can provide alternative
implementations so we only have a multiple producer
single consumer channel in the standard library if you need a multiple producer
multiple consumer channel you can install a package and get this sort of
alternate implementation and that’s one of the really nice things about this
particular aspect of the design is that the more you move out of the language
the less the compiler needs to express expressly support these kind of things
which is which is pretty cool the other thing that happens the sort of
marks this transition for me from the great new years to the type system years
was the grade and step down from the project itself he is still kind of around a little bit
but you know after you work on something for years and years and years you know
you eventually want to do something else with your life and now that it’s sort of
head like picked up steam and other people were there to carry the project
on he decided that what was best for him
personally was to stop working on rust and kind of take some time off and and
get away from things and so I think this is very interesting for a number of
reasons um the first thing is is that while
grading was sort of this benevolent dictator and he would absolutely hate
that term which is kind of the great guy he is it also means in some way his influence
has grown because when great does show up in a discussion were like whoa we haven’t heard from grading in a year
and now here he is weighing in so like ironically by leaving he sort of
gained a little bit more sort of social power but another really i think awesome
aspect of this like I I grading is a wonderful person and so I’m kind of sad that he’s not
around but at the same time I’m also glad that he’s not around because what
this means is we don’t have our sort of original person around to tell us what
to do which means that no one has that
particular level of authority and so I was previously involved heavily in the
Ruby and rails communities before I sort of moved in to rest and both Ruby and
rails still have their original creator around sort of steering the ship and
mats and th are also very capable people but I sort of think i strongly prefer
this situation where we have a very distributed leadership and that means
that things get discussed a lot more there’s no like one person decreasing by
fee at like this is what’s happening because I wrote this thing originally so
you all just have to deal with it and so that’s a very interesting i’m sort of
aspect as well so because i don’t have a slide on this later so what eventually
happened was we developed a core team which I’m a member of which started off
at six people and now is nine people but we also have this like federated
governance structure where each area of the project has sort of its own team
that manages what goes on and the core teams role is really to ensure coherency
across the project and sort of to make sure the cross-cutting curtain concerns
or develop our own dealt with so each of these sub teams has one core
team member on it whose job is to kind of like escalate
you know if they see that like oh this thing might affect the other part I need to make sure and go and notify
this other team of the work that we’re doing so really we went from like one
person in charge – like 30 or 40 people like loosely in charge which is been
wonderful ok so i was talking a lot about channels
being rude for the language i have some syntax to kind of show you the way that
it used to be in the way that it is now so here was a function called receive
that took in a task names task and a channel that was a you know has a t-type
parameter name chan and so in this particular case task and chan are
keywords of the language actually knew about and could reason and understand
when compiling to verify that things were safe if you were to write that sort of a
similar thing today it would look more like this so we now
have these use statements bringing in different parts of the standard library
and then we have this sender and receiver and a channel is just a tuple
of a sender and a receiver so this is kind of now we have to find a structure
to put these things in and package them up and they’re like no longer you know a particular keyword so we got
a little bit more verbose but again this allows us to sort of swap out the you
know implementations for different ones if you need them so there’s like an
increase in power another great case study example and
something that rust kind of originally got a little famous for that we
abandoned was pointers so rust used to have between who you could ask for –
like 20 different kinds of pointers and they were there really were only three
ish kind of its it’s complicated the three where the big ones and uh so we
had this syntax let x equals at five and that was a
garbage collected . er back when we had the GC originally once we sort of got rid of the garbage
collector we put in like a reference counter this became a reference counting
pointer that sort of had a to do deal with cycles and then that never happened
because we actually killed the feature entirely before we bothered implementing
the cycle collection let y equals till the five was what was
called a unique . at the time and this was an RA style you would allocate a
value and then we would go out of scope it would be deallocated pointer and then
let Z equals ampersand five this was called a borrowed pointer and
it was more like a pointer in see but with this additional type checking that
rest does so just a reference to a value of some kind so these things are all sort of in the
language still today but now they kind of look like this so the GC pointer is gone entirely we do have a reference counted type
actually two of them at this point and now this unique pointer is now
called a box which is a you know common term for putting an object on the heap
and then we call the bar pointers references and they still sort of
function the same kind of way but and so they still have some tax in language but
the the tilde pointers don’t exist but have a standard library then one thing that happens and this is
a fun thing about doing sort of . ization and dealing with histories is
the type system years also had some really great improvements to the
language that were not related to the type system oh well names are hard right as a
classic computer science issue and one of the things that we invest in heavily
early on was this thing called cargo and creates . i oh so cargo is like a
combination build tools / package management system and create audio is an
online repository of open source code that people are able to share and so
when you start a new rest project you will often do cargo new food – begin to
get a binary instead of a library change in the directory and we actually
generate a hello world program for you so that you don’t even need to type it
out yourself and so when you type cargo run it will
compile your project and then actually run and executable and printed out but
this is the most basic example the real power of cargo comes in when you start
having dependencies and also a I guess before getting dependencies I was lied about like what this does
under the hood so if you pass – V you get the verbose output and so a regular
old car go build you can still see this compiling fool line but this actually is
running this gigantic commands uh you know under the hood this this
sort of reminds me of like installing gentoo or something or like you know
using a make build build system you get this scroll by of all these things but
one thing that’s also really important it’s not just about hiding all this info
about what is going on here it’s also about enabling common patterns
so if you pass – release you get a release build instead of a regular build
and what’s interesting about this I is if you look on the line right below
running rusty there’s a – gee there and if you look below the running recipe
there’s a – co-op level three so like by default you get debugging
symbols automatically when you do a debug build and you don’t get debugging
symbols and you get the you know high level of optimization of a release build
and this is just out of the box and so this is this this kind of thing
this is of course also configurable because sometimes you need release mode
so you have an acceptable performing thing we still want to bug me symbols
and whatever you can customize this but the important part is about enabling
common patterns because it enables people who have not come from a compiled
language to trivially sort of start using language in a real way without
having to dig into the details so I know as well I i learned see relatively early
but one of the reasons i got away from see in my life was having a deal and
manage with all these compiler flags and knowing what all this stuff was and like
figuring all this out and so it’s a really really great thing
for accessibility to people that are new they can learn what these flags mean
later they just need to know bill does a
regular build and build – release is a release build so it’s very powerful another thing is that there’s this
configuration file for cargo so we use the Tamil format to do this because
basically a all configuration files have lots of downsides and Tamil as a
reasonable one that still has some downsides but less than all the others we sort of thought and also some of the
good ones like I is just not standardized whatsoever so everyone is a
slightly different idea what is anyway so we have this metadata that gives you
the name of the package and a version number and the authorship information
which we pull from your get or material or whatever by default so it is
automatically in there but an extremely powerful feature is the ability to add
dependencies so here I’m going to add the time create
at any version and the log great and I want a version is compatible with zero
point two point one when I chain make this file a when you add this to my
configuration file the next time I type cargo build cargo
knows how to go to create cio grab the registry information and then download
and compiled these dependencies but what’s important is you’ll notice
that i only said anytime and log but now i have log and Lib C and G C and time
and foo so as it turns out that both the time
and log creates depend on lipsy and so cargo is able to figure out a version
that was compatible with both of them I’m and download all the dependencies
and so it not only knows how to grab the dependencies I’ve told about the
dependencies of those dependencies and this is an extremely powerful feature
that is just really really nice and convenience a lot of systems languages
are sort of before this kind of thing was regular when I show this to like
Ruby programmers like yeah we do this every day is called butler but when you
come from the system’s world like the this is the thing that has not existed
and so it’s really really really powerful for enabling code reuse across
an ecosystem and as that ecosystem is developed there’s a number of extremely
interesting things that have come out of it so as an example i’m working on my
little operating system and rust there actually is a package called x86
that gives me pre-wrapped on x86 platform specifically you need assembly
instructions to manage things like the IDT and the GT and so there is a package
that you can install that already has those assembly functions written out for
you and wrapped up and rest functions so you can install and use the package to
manage your interrupt table if you’re writing the thing and rust which is like
the idea of using open source packages to help you build your operating system
is just something is extremely exciting to me anyway ok so and as part of this i mentioned
like rubios say this part is normal as rest community grew during this time
period they’re sort of three camps that people
came from x equals plus users accepting language users and X functional
programmers and in some ways rest is a combination of these three things but i
like to say that all three of these groups bring something to the table over
us but they also get something out of it so the C and C++ programmers or the
other people from the system z kind of camp what they bring to rust is this
assurance that rust will be good for low-level use cases because they require
systems stuff so you know they’re able to point out like hey this feature
actually you know is not particularly great for low-level users or we need
this additional feature you know to be added for little use
cases and what they get out of rust is a language with a really strong type system and a
package manager and all these other kinds of features built on top of you
know the in a way the kind of same semantics that are used to scripting
language users and I would have called myself being from this camp personally
because i wasn’t as I said involved in Ruby before rust what we bring to the table to rust is a
an appreciation for things like user interface and experience we are really used to and especially
rubios everything being extremely convenient and what we see something
that getting complex we like wrap it up and try to make a convenient again so the idea of cargo came directly from
the Ruby and npm you know JavaScript kind of package manager systems and we
brought our our expertise there to help make that happen when we originally
pitch cargo the X c++ crowd was like you can use those cute little tools if you
want to but I’ll stick with my make files thanks and then for five months later they were
like why did I ever still want to write make files so that was kind of what we
like brought to the table and what we got out of rust was a language that was
extremely low level and performance so you know ruby is not the fastest
language in the world but that’s also not what we use Ruby but sometimes you
need things to go fast and so you know having the ability to drop down to a
lower level is extremely interesting and for a variety of reasons a lot of
existing scripting language users have already rejected see your C++ either
because they looked at it and did not like it or because they tried and failed and so we’re seeing a lot of people
where rest is their first ever low-level programming language and that’s
extremely exciting to me to get more people into low-level programming and
then finally x functional programmers what these people bring to the table is
that type systems knowledge and all this kind of stuff and what they get out of
rust sorts sort of similar description language people where you know this kind
of feels like an ml but it runs more like see kind of thing and so that’s extremely exciting so all
three of these groups have made rest what it is today part of that is the RFC process so in march of 2014 again we have this
federated governance structure so there’s no one person to be able to decree what is
going on and so we actually have a NRC process for that it was largely inspired
by pythons pep process and it’s for introducing significant language changes
there have been 1600 of these submitted since march of 2014 and we’ve accepted 243 of them they’re
still there are 69 more that are under active discussion right now and so even the core team has to go
through this process nobody is allowed to make big changes to
rest without discussing in front of people and this process has been
wonderful first of all in order to actually get
feedback on opinions so the number of times where we as the core team have
been like we want to make this change we talked about it and then we propose it
were like it’s great and then people bring their expertise
into the thread and then we go oh we were completely wrong actually you
were totally right and it’s like a very collaborative interesting process that
has only made rust get way better ok so a a brief thing about rust will
stop in history quickly to show you i’m gonna show you a
little bit about rust code and the kinds of problems that resolves so this is
Ruby code we have an array named v we push a string called hello to it we make a reference to the first element
of this and then we push a new thing onto the array and we print out like
what is the first element so this kind of works in Ruby because
that doesn’t actually make a real reference it makes a copy and because
everything is behind a pointer and everything is garbage collected these
are all able to be changed by the runtime like what location the data is
able to be modified so this totally works in ruby is like not invalid code
but if you translate it to c++ with a vector of strings and then you push
hello on to that vector you make it an actual reference to the
zeroth element of the array and then you push on to the vector and print out x what happens well with – w all and – w
air g + + will not complain about this code whatsoever it is totally fine but
you run it and you get a sec fault and so the reason this happens if you
look at the documentation for pushback it says if the new size is greater than
capacity than all iterators and references are invalidated and it’s like
it’s great that that’s in the documentation but like I’m not
necessarily remembering all of the details of all the functions that I call
when i’m doing this kind of thing I’m and this example is relatively
trivial and yes real C++ programmers would not necessarily make this kind of
mistake but you can’t show real examples on slides so there’s just a fundamental
tension there we have empirical evidence that no
matter how good you are sharp languages still end up introducing these kinds of
problems and rest is not free of those problems it’s just aiming to eliminate
the vast vast majority of these kinds of problems so in a specific example here is the
rest code that does this you know we have a vector we push on to
it we make a reference we push on to it and we printed out you notice this is kind of a weird like
mixture of that Ruby code it’s like weirdly it’s more like the Ruby than it
is like the c++ but when you try to compile this and rust you get a
compile-time error hey you cannot borrow v is mutable
because it’s also borrowed is immutable when you make that reference rust knows
that if you put something on to it would be invalidated so it actually gives you
of this error specifically and points out like when you made the reference that’s where this thing went wrong so
you can’t do the push while you still have it and it ends when the function is
gone if you were trying to do other things we’ve provided compile-time
errors for these kinds of problems and this is sort of the core value
proposition of rest is that you get the exact same code as you would from C or
C++ but you get this stuff checked in a way that you know you don’t have to
remember the details of this kind of stuff another brief thing about rusted a
concurrency so i’m gonna show you some like increasingly verbose examples and
then some simpler ones so this uh spins up 10 different threads so we
mapped from the range of 0 to 10 and then in each element of that we spawn a
new thread and print hello world and then we collect up these the guards that
come back so when you spawn a new thread you could handle beck and call join the
handle but it also gets called whenever the value would go out of scope so this
will end up hitting the end of the scope of main and then pausing until all the
thread guards go out of the way and then you know you get a hello world so this
is kind of a little verbose but it’s also just printing hello world yeah so here is a slightly more
complicated example involving mutable state across threads and so in this case
we have an atomically reference , pointer with a mutex inside and that
holds a vector of numbers and then we need to make a new vector for the
handles loop through three times increment the reference count using the
clone method spin up the new thread inside that new thread call lock to
unwrap the mutex then get that value back and then we can insert that
particular part of the array print out what it is a push that handle from the
thread onto the global list of handles and then here i decided to explicitly
write out the joint rather than just let it go out of scope so this is like a lot
of complexity but the reason this is a lot of complexity is because you have
complete control over all of the details and rust is not trying to hide those
details from you so for example maybe a mutex is not the
synchronization primitive you wanted to use here maybe you would prefer to use
something like a read/write lock so you have the ability to sort of
change that out from underneath because this is kind of exposed to you but even
then this is like a little a little too
verbose but as I mentioned earlier because we have this package ecosystem
we can actually do much better so the crossbeam crate provides the
ability to specifically create threads that will join before their parent
function terminates and not only does this mean we get this significantly
simpler code example so in this example we have this cross
beam scope function that gives us this scope what kind of object and then we call
spawn on that and so it knows that all these things will join before the
overall scope goes out of scope and because we know that will join we don’t need to do the mutex and the
reference counting stuff we can actually take mutable pointers so this for I & ampersand mute numbers
means that every iteration is immutable pointer to that particular element of
the array and then we’re actually able to increment it directly without having
any synchronization whatsoever because the type system is able to say okay you
have a disjoint pointers to each element of this array and I know the parent
stack frame is going to be valid by the time this thread is over so it’s
totally fine and safe so we’re able to through the type system
eliminate actual synchronization primitives that would be necessary if
you did not have them so that’s really really cool and it’s also easier to use so that’s nice ok enough about that code I want to talk about the next time .
which is the release year so we put out rest one point out . out alpha on Friday
genuine I’ve 2015 and the first beta on februari 16 we sort of said we don’t
know how many betas we’re going to have to eventually finish up and one point
out actually ended up happening on a 15 2015 and so from that time period until
shortly after the release you know it was like there’s been eight
years of rust being developed by changing every day and I like the
language but I can never use it because it’s changing at one point out we said
it will still change but only in backwards compatible ways so no longer
do you need to rewrite your library five times a week in order to keep current
with rust master and that is also enable a lot of people to start actually
building real and larger things on top of the language so during this
particular time . we are still continuing to push the boundaries of
what is possible with the language and I what for for particular aspects of this
so it’s about the ecosystem the tooling the stability in the community I think that one area and this is one of the reasons
interesting to be researching at Mozilla like to be a researcher at Mozilla is
that when you’re in academia you’re not necessarily concerned about
helping industry but when you’re in this weird research development part of the
organization that in industry you eventually have to like productize your
research and it’s not like I could mean NEVER productize research obviously but
I think it’s one of the area’s why like PLT has not escaped into the industry
more is because there has never been an organization that’s willing to pay for
all of the extra work it’s not about just the PLT because
language adoption is more than this language has good features if that was true the language ecosystem
would work very differently there’s also all this extra stuff around
the language there’s also work that you have to do if you want your language to
be adopted in the industry and it’s just as much problem as the actual like PLT
dev I’m itself so we’re also really working on innovating with rust in a
number of different axes so the first is this ecosystem I told you about car goes in cargo and
crystalline earlier this is enabled super easy sharing of code and so we
have as a last night over 5,000 packages now in this you know year since we’ve
had rest one point out so there’s a lot of activity My partner actually works at 10pm and so
she sees this number and like laughs because they’re pushing you know like
millions of packages every day but we’ll get there 1410 total contributors to rest see so that is a really large number for a
programming language and that’s just the language itself not the other stuff
related to and other things and like most common contribution graphs this is
a long tale so it’s not like we have 1400 people who are working on this
every day a significant number of them have only
ever had one commit but like you know it’s still impressive that we’ve managed
to pull these many people in and we’re still looking to pull it even more
people we more contribution from a lot of people
sort of three of the large areas where arrests or being used as game
development operating system stuff web development there’s a whole bunch of
other things as well but these were some of the earliest kind of micro eco system
so there’s a whole miniature community within the rest community of game
developers were developing their own ecosystems of packages to do that and os
people and web stuff it’s interesting Chris I always actually
implemented in rust itself so it’s a rush back end with an ember Jess front
end and it uses like 30 megabytes of memory residents basically which like
you can barely spin up a ruby process in 25 megabytes of memory and the new load
rails and using like 300-350 so that was something that was extremely shocking to
me when I went from my old web stuff to rest web dev we’ve been innovating on
tooling so cargo was extremely you know there’s a reason I keep bringing it up
because it is wonderful we are working on this tool called rest formats which
is one of the best things that the goal language ever introduced to people obviously it was not the first language
to do so but it’s one of the first that made people realize this was a really
wonderful idea to stop arguing about syntax and structure and just like make
it happen I like to joke that the Ruby world
doesn’t have an actual Ruby format we just like do it ourselves because people
get really mad if you use for spaces versus two spaces and don’t even mention
tabs um so we would just like do that
ourselves basically by introducing a tool that did it is just way better like
why do I have to do this manually and so it’s taking us a little longer to put
this together because uh it’s it reaches in the compiler internals and why the
language is stable the compiler internals are not as stable so it’s
taken us a while but it is coming very soon you can use it today but it is not like
fully done IDE integration I put pretty okay
because we’re like we’re doing pretty solid for a young language but there’s
still lots of work to do specifically it has been great timing
around microsoft has made visual studio significantly more open and being able
to work with like gb stuff and so that’s been really wonderful and windows and a
number of open source editors have plugins i personally use them and there’s a you
know plug-in to do great stuff with that so all that stuff is coming along and
its really really important the number one response to hear from like people at
that don’t currently is rust or why they would like to stop not use rest yet is
because they’re like I need my ID and I need my ID work that way so it’s
extremely important for adoption to get this right we do not have a rest fix
tool so go has this tool called go fix that will let you upgrade between
versions I think that is less used today although
maybe that’s not true but I know it was very important before they had their one
point out but we don’t have this tool and that is because one of the things
that we’ve been doing a another like innovative area is release engineering so we have the stability policy and that
means that after rest one . o everything needs to be backwards
compatible unless we find sound this errors in the type system or something
catastrophic like that we have not yet we’ve had minor ones of those very very
minor and so we put out a new one . x release every six weeks which for a
programming language is an extremely aggressive really schedule many
languages go with one release a year we have released every six weeks the most recent one was last week
actually but because we focus on compatibility it means that you as a rest developer
when a new rest comes out you upgrade your compiler and all your stuff still
works like there’s not this sort of big change I lived through the ruby 1.8 – 1.9
transition and it was very very tough for all of us the Python ecosystem is still dealing
with the Python to python 3 move like five or seven years later breaking backwards compatibility is is a
really really bad thing for your users and stability is really really hard there are some things about life trust
that i would love to change but I love my users more and so it is unfortunately you’ll never
have a perfect programming language and continually breaking backwards
compatibility in order to try to achieve that personal language is just not good
for your actual users who don’t necessarily care that this is not
perfect they just want to like not have to rewrite all the code to upgrade
things and so additive change is really ultimately the way to go i think and we
as an industry are sort of learning this slowly that we can’t just
rewrite the world constantly even on the two or three year cycle that we like 10
to rewrite the world in a lot of parts of industry that just still means you
can’t build anything that lasts longer than a couple years because your
foundation is gone and so it’s also funny because like as a user as a
programming language designer I want to fix my sis mistakes and change
things but as a user of a programming language and like please don’t break my
stuff and so I feel both of these sides constantly one thing that we do in order
to ensure the stability is we have this 5000 packages that are open source we have a tool called crater and as part
of the process like the week up until the release we actually run the new version of the
compiler on every single package in the ecosystem to see if it still compiles
are not as like a massive regression test and so we can actually guarantee
that when a new release comes out none of your code will break because
we’ve already tried it and it already works the other thing about this six-week
model is that it is a staggered on a train model so what happens is a master turns into
beta and the last beta turns into the new release so we also have a six week
period sort of like a release candidate of the
next release in order to make sure that we haven’t you missed out on a
regressions and things like that and so it’s part of this train model that
happens another thing that’s really wonderful
about this process is there’s not a lot of pressure to put a feature in before
it’s ready so if you have a one-year release
schedule and you come up with a really great new feature in october or november
and you release in december there’s an incredible amount of pressure
to just ship it because you’re going to miss the train and wait a whole nother
year before that feature comes out but this means you might not give the
feature the level of care and attention that actually deserves and so one of the weird things I think
is that shipping faster actually means that we have better quality because it’s
not a big deal to bump it back up to the next release like it’s only coming six
weeks from now so we have a large amount of incentive
to make sure that we get it right because we really so often which is very
counterintuitive but i think has been extremely good for the language so innovations in
community we’ve had a code of conduct since the very first commit in the rest
depot and this is a contentious sort of area industry where a lot of people are
battling this out on various message boards and Twitter and whatever else but
we think this is extremely important that we treat people like humans like
it’s it’s true that software is wonderful but like people matter more
than software so just like be reasonable humans to other humans and don’t be
jerks it can be hard but don’t and so one of
the things that people continually talked about because we have developed
this culture of like please focus on technical arguments not personal
arguments you know please take some time off you
clearly getting a little mad like trying to work with each other like as adult
humans people continually reference how wonderful and welcoming the rest
community is and like helping out new people there are a lot of language IRC rooms
where if you join and ask a basic question you get laughed at if you join the rest room and asked a
very basic question we will say welcome like thank you so much for using rest so
and i know this is a fact because when i started using rest again it was changing
every day and so I would come in and ask really basic questions like once every
month because i was like everything changed I can’t figure out how it changed please
help and in the main room we have about a thousand people in IRC
at all times which is also pretty cool you can get help pretty much any time of
the day and we also have split up in a sub room so they’re specifically a
beginner focused help room and a compiler dev help room and a you know
tooling help room and that kind of stuff um ok so finally I’m going to the end
here the production year so this is what i’m
calling this next period of rest is history we sort of just seen once we had one
point out that the funny part about like releasing things is that people like
okay when’s one . happening and so we say all right here’s one point out and
in like a week after one point out there like what’s the largest production
application running and rust you have anything that’s like two hundred
thousand lines of code and it’s like did you really think that we could build a
200,000 line the thing in like one week like he just needs time right so there’s
this weird interesting lag time between when
stability happens and when you actually see a deployed real things in industry
just based on the fact that like riding a significant project takes a
significant amount of time and you can only start at the time whenever things
are you know stable so now we’re just seeing like an explosion of people using
rest in production and it felt weird to me at first like why did we go from one
or two production users to 20 production users in the last two months and it’s
like oh this is only just because people are finally actually shipping the thing
and announcing it took time to build so i’m going to set a couple of production
users to sort of talk about how this has worked so far so on i’ll start off with mozilla one of
the things while we are trying to rewrite ghetto at the same time we are
really really like moving pieces of rust code into firefox because clearly we
can’t just like wholesale swap that out yet and we want to gain some of the
benefits of rust in the existing code base already so you know you can’t just
like just rewrite four and a half million lines of code right you have to
do an incremental replacement strategy and so today on a Linux and Mac os10
firefox 45 has some rust code inside of it so you may be using dress code
already and do not even realize it and one really exciting feature that we
just announced in this release the rust code specifically it’s an mp4 parser has
had over a billion executions with a hundred percent correctness so we do telemetry on firefox you can
opt into and report problems and so we specifically instrumented like the rest
code to see if it worked or not and has been a hundred percent so fingers
crossed that will last we’ll see how long obviously nothing is perfect firefox 47
is going to have it on windows and so then we’re going to see an even bigger you know like a billion sounds like a
lot but like not really it will be many many more and then
around the time of firefox 49 or firefox 50 is the plan for android a firefox to
start having dress code in it and so it we only have a little bit now but it’s
only going to grow dropbox recently went public that the core of their product is
now written and rust so there’s this big article in wired magazine about like
Dropbox moves away from the Amazon Cloud and it’s really just they build their
own data servers Dropbox’s core technologies go and they
use it as a default for almost everything on the server but as part of this project they
basically wrote a new file system is the simplest way to explain it was obviously
more complicated than that and so they implemented that in rust so
they’re go code actually calls in to rest code or rather it’s IPC right now
but eventually it’s going to be in the language doesn’t matter you can go read
the post if you’re interested in the details but uh you know they pretty much
like they actually put into production in december but only announced in April
because they wanted that time period of like hey did you notice how the universe
didn’t break like bleep we ship new code like it has been working well for months
so that was kind of exciting Tilda is a company that is well known
for being part of the Emperor jas community employees the original member
authors and one of those people you could catches on the rest of your team
now and that’s because skyline io is actually one of our first production
users they’ve been using rest for years now
and it’s a performance monitoring system for rails apps so you install their a skylight package
into your rails application and it gives you monitoring capabilities they wrote
that ruby gem in rust which is cool and so I was talking with you about this a
couple weeks ago and he and I said like so how stable is this been for you and he said well we’ve had two crashes
in the last four years and that’s not to say that like he’s like what’s
significant about this this number is that i can remember both of them like
it’s not like we’ve had a number of problems and like you know oh it’s mostly good but we sometimes
have issues he’s like no I can literally count on one hand the number of times
that we’ve had like a serious issue and one of those two times our fault not
your fault um so that’s kind of interesting we just
started a page that we call the Friends of rust and that’s like organizations of
using rest in production and so there’s a URL there and is currently 22 organizations and
we’re adding more as people sort of announce like hey I’m finally using rest
at work cool would love to have your logo on
this page one thing that’s not on that page that we want to add in the future
is our universities so there was a one University class and
operating systems development and rust 23 years ago that they did not do again
and the this semester there are two different University
classes teaching rest i had the pleasure of guest lecturing at the one at a
university of pennsylvania a couple weeks ago and the other one is a
university of iowa somewhere in the Midwest they’re teaching rust so there and I was
MIT last week and they were talking about how they’re excited to start using
rest in some capacity some researchers are using it for their research not a
mighty like itself but we’re really excited to see University of take a rest
as well so hopefully i’ll be able to say 22 you know 50 organizations and ten
universities or whatever this year we’ll see how it goes okay I’m
out of time that is all uh I hope that I gave you a
little bit of my love of the rest language and I hope that if you try out
rest you love it too but importantly if you don’t that’s totally fine with me as
I said programming languages are good for different reasons so like we try
really hard not to be combative about other languages and so I don’t know
where r us is necessarily super going in the future but if you’re interested I
would love to have some of you come make that future into reality so thank you so
much yeah I think this is like coffee break now
yeah totally so i will be having coffee wherever that is if you have questions
just come up and talk to me i’ll be hanging out so I can launch

Comments 10

Leave a Reply

Your email address will not be published. Required fields are marked *