Return to Video

Josh Matthews - An Introduction To Rust

  • Nesincronizat
    (technical issues/chatter)
  • Nesincronizat
    (People are not important.)
  • Nesincronizat
    (There are no peole in technology,
    just replaceable components.)
  • Nesincronizat
    (Laughter)
  • Nesincronizat
    6:18 Alright let's do this
  • Nesincronizat
    I'm going to tell you about what Rust is
  • Nesincronizat
    Why Rust is a part of Mozilla's work
  • Nesincronizat
    and when it's going to start
    being a part of Mozilla's work.
  • Nesincronizat
    Let's begin
  • Nesincronizat
    so Rust is a new programming language
  • Nesincronizat
    that has been created inside Mozilla
  • Nesincronizat
    and shared with the outside world
  • Nesincronizat
    The goal of it
  • Nesincronizat
    is basically
  • Nesincronizat
    anytime when you traditionally
  • Nesincronizat
    as a developer
  • Nesincronizat
    have reached for C++
  • Nesincronizat
    because you need to have certain
    guarantees
  • Nesincronizat
    about performance for example
  • Nesincronizat
    we want Rust to be a viable alternative
  • Nesincronizat
    in every single case
  • Nesincronizat
    There should be no reason to choose C++
  • Nesincronizat
    over Rust
  • Nesincronizat
    in the ideal future
  • Nesincronizat
    So it began as a side project
  • Nesincronizat
    of a Mozillian named Graydon Hoare
  • Nesincronizat
    before 2009
  • Nesincronizat
    he began working on it full-time
  • Nesincronizat
    in 2009
  • Nesincronizat
    because Mozilla saw the ideas that he had
  • Nesincronizat
    and said we can see
    how we could put this into Firefox
  • Nesincronizat
    and make the product better
  • Nesincronizat
    if we actually had this language
  • Nesincronizat
    so that's when we started investing
    time and resources into it
  • Nesincronizat
    fast forward a few years
  • Nesincronizat
    we now have a team under
    the Mozilla Research umbrella
  • Nesincronizat
    whose working full-time
    on improving the language
  • Nesincronizat
    and we released version 1.0
    last year
  • Nesincronizat
    and every 6 weeks we
    now release a new version
  • Nesincronizat
    so we just released 1.13
  • Nesincronizat
    and there is a large community
  • Nesincronizat
    around the language now
  • Nesincronizat
    so not only do we have developers
  • Nesincronizat
    working in Mozilla on it
  • Nesincronizat
    some of those developers
  • Nesincronizat
    are part of what is called the Core Team
  • Nesincronizat
    and those are the people that decide
    the future of the language
  • Nesincronizat
    and help shape where it's going
    as time goes on
  • Nesincronizat
    so in addition to our employees
  • Nesincronizat
    we have volunteers
  • Nesincronizat
    and employees from other companies
  • Nesincronizat
    that are now depending on Rust
    for other products
  • Nesincronizat
    and they're helping shape this ecosystem
  • Nesincronizat
    which then has a large number of libraries
  • Nesincronizat
    that are being developed by people
  • Nesincronizat
    who are enthusiastic about the language
  • Nesincronizat
    it's got a lot of downloads happening
  • Nesincronizat
    since the last time I gave this talk
  • Nesincronizat
    there've been 10 million more downloads
  • Nesincronizat
    and 300 new libraries published
  • Nesincronizat
    so there's a lot going on
  • Nesincronizat
    there's also the friends of Rust
  • Nesincronizat
    which I'll show you
  • Nesincronizat
    [Web page: Rust reliant Companies]
  • Nesincronizat
    a page showing lots of different companies
  • Nesincronizat
    that've told us
  • Nesincronizat
    "Yes, we are relying on Rust
    in production,
  • Nesincronizat
    we are very excited about these prospects".
  • Nesincronizat
    so, lots of cool things going on there
  • Nesincronizat
    so the reason for Rust
  • Nesincronizat
    is that we've in the past
  • Nesincronizat
    10 or more years of using Firefox
  • Nesincronizat
    and Javascript in Firefox
  • Nesincronizat
    sorry C++ and Javascript in Firefox
  • Nesincronizat
    we've come across the fact that
  • Nesincronizat
    there are some pervasive problems
  • Nesincronizat
    that are caused by using C++
  • Nesincronizat
    that is
  • Nesincronizat
    writing code that makes use
    of local threads
  • Nesincronizat
    is very difficult
  • Nesincronizat
    it's easy to write incorrect code
  • Nesincronizat
    and it is very easy to write code
  • Nesincronizat
    which is unsafe
  • Nesincronizat
    and that translates into
  • Nesincronizat
    security exploits
  • Nesincronizat
    things that are stored by governments
  • Nesincronizat
    and by hackers
  • Nesincronizat
    all over the world
  • Nesincronizat
    and used to
  • Nesincronizat
    steal data from users
  • Nesincronizat
    and take over their computers
  • Nesincronizat
    using the browser as a vector
  • Nesincronizat
    there's a huge number of these
    that are released every year
  • Nesincronizat
    by security investigators
  • Nesincronizat
    and there's competitions
  • Nesincronizat
    showing who can pwn a browser the quickest
  • Nesincronizat
    so we looked for ways to address this
  • Nesincronizat
    by creating a new language
  • Nesincronizat
    and it turns out that actually
  • Nesincronizat
    both of these issues
  • Nesincronizat
    make it difficult to write parallel code
  • Nesincronizat
    that makes use of modern hardware
  • Nesincronizat
    and writing code that is safe
  • Nesincronizat
    and not exploitable
  • Nesincronizat
    turns out they can both be addressed
  • Nesincronizat
    by introducing the concept of Ownership
  • Nesincronizat
    in the language
  • Nesincronizat
    so let's talk about what that means
  • Nesincronizat
    Ownership encapsulates 2 ideas basically
  • Nesincronizat
    it is what the owner of a value is
  • Nesincronizat
    whether there are multiple
    owners of a value
  • Nesincronizat
    or mulitple users that are sharing a value
  • Nesincronizat
    and additionally when that value
    is actually valid
  • Nesincronizat
    what is the point in the program
  • Nesincronizat
    in which it's actually safe
    to interact with the value
  • Nesincronizat
    and so from this we can derive a few rules
  • Nesincronizat
    that if there is only a single owner
    for a value
  • Nesincronizat
    that value can be destroyed
    when the owner goes out of scope
  • Nesincronizat
    because there are no ways
    to reference that value anymore
  • Nesincronizat
    similarly if a value
    has only a single owner
  • Nesincronizat
    that means that it is legal to mutate it
  • Nesincronizat
    because no one can observe
    the change to that value
  • Nesincronizat
    and finally
  • Nesincronizat
    if you have multiple owners
  • Nesincronizat
    you need to have
  • Nesincronizat
    something called Borrowing
  • Nesincronizat
    which is
  • Nesincronizat
    you still have a single owner
  • Nesincronizat
    but other people can observe it
  • Nesincronizat
    but it cant be changed during that time
  • Nesincronizat
    so let's talk about Analogy here
  • Nesincronizat
    if I've got a colouring book and a marker
  • Nesincronizat
    and some friends
  • Nesincronizat
    we can establish some rule
  • Nesincronizat
    the colouring book and the marker
  • Nesincronizat
    are my property
  • Nesincronizat
    so they go with me wherever I go
  • Nesincronizat
    if I leave no one else can
    observe the book
  • Nesincronizat
    or colour in it
  • Nesincronizat
    however I am able to loan the book
    to someone else
  • Nesincronizat
    and that means
    they're borrowing it from me
  • Nesincronizat
    that also means that I can't colour in it
  • Nesincronizat
    while they're borrowing it
  • Nesincronizat
    because that's rude
  • Nesincronizat
    so they can also choose to lend it
    to people around them
  • Nesincronizat
    but that means that if
    anyone else is borrowing it
  • Nesincronizat
    they need to give it back to me
    before they leave
  • Nesincronizat
    because it's my property
  • Nesincronizat
    and only I can leave with it
  • Nesincronizat
    additionally
  • Nesincronizat
    If I have the marker
  • Nesincronizat
    I'm able to colour in the book
  • Nesincronizat
    if I have the book
  • Nesincronizat
    I can also give the marker to someone else
  • Nesincronizat
    and that means they can colour in the book
  • Nesincronizat
    if they have it
  • Nesincronizat
    that means that I'm no longer able to colour
  • Nesincronizat
    because there's only a single marker
  • Nesincronizat
    and finally if I want to leave
  • Nesincronizat
    but I dont actually have
    the book in my posession
  • Nesincronizat
    there's a problem
  • Nesincronizat
    either I need to wait until
  • Nesincronizat
    someone gives me the book back
  • Nesincronizat
    or I actually need to give it
    to someone else
  • Nesincronizat
    and say OK it's not my property anymore
  • Nesincronizat
    it's yours to deal with
  • Nesincronizat
    so Ownership in Rust
  • Nesincronizat
    if we have a Type we call a ColouringBook
  • Nesincronizat
    and it gives us a constructor
  • Nesincronizat
    that returns a new instance
    of a ColouringBook
  • Nesincronizat
    we can say OK
  • Nesincronizat
    here is a variable called a Book
  • Nesincronizat
    which we will say
  • Nesincronizat
    stores this ColouringBook value
  • Nesincronizat
    that means that we can now call
  • Nesincronizat
    call this colour method
  • Nesincronizat
    which will change the ColouringBook
  • Nesincronizat
    in some way
  • Nesincronizat
    it'll colour in it
  • Nesincronizat
    that's fine
  • Nesincronizat
    we can mutate it
  • Nesincronizat
    because we only have a single owner
Title:
Josh Matthews - An Introduction To Rust
Description:

more » « less
Video Language:
English
Team:
Mozilla
Proiect:
Rust
Duration:
28:19

English subtitles

Versiuni Compare revisions