C++Now 2017: Niko Matsakis "Rust: Hack Without Fear!"

  Рет қаралды 60,458

CppNow

CppNow

Күн бұрын

cppnow.org
-
Presentation Slides, PDFs, Source Code and other presenter materials are available at: github.com/boostcon/cppnow_pr...
-
Through the concept of zero-cost abstractions, C++ has shown that it is possible to combine low-level control with high-level programming concepts. Rust is language that aims to offer the same sorts of zero-cost abstractions that C++ is capable of, while also enforcing memory safety and data-race freedom. The secret sauce is Rust's core notion of "ownership", which enables:
- Memory safety without garbage collection;
- Concurrency without data races,
- Abstraction without overhead.
In this talk, I'll explain ownership and show how Rust uses it to guarantee thread safety, amongst other things. I'll also talk about how Rust is designed to scale to large code-bases, sharing some of our experiences here at Mozilla from integrating Rust code into Firefox.
One final theme of the talk is that the benefits of ownership go beyond having fewer bugs: once you are freed from the need to prevent memory-safety violations, it becomes possible to write -- and *maintain* -- programs that aggressively pursue parallelization and other kinds of optimizations that would have been too risky or too difficult before.
-
Nicholas Matsakis is a senior researcher at Mozilla research and a member of the Rust core team. He has been working on Rust for nearly six years and did much of the initial work on its type system and other core features. Prior to working on Rust, he did his undergraduate studies at MIT and completed a PhD at ETH Zurich in 2011. He also spent several years at DataPower Technology, a startup since acquired by IBM, working on the JIT compiler and networking runtime.
-
Videos Filmed & Edited by Bash Films: www.BashFilms.com
---
*--*
---

Пікірлер: 57
@atommixz
@atommixz 7 жыл бұрын
The best video that explains the features of Rust. Everything is clear even without clear knowledge of the English language. Thank you very much!
@OssamaZaid
@OssamaZaid 6 жыл бұрын
One of the best Rust talks out there, as a js fanatic myself, i finally found a systems programming language i can understand and use without fear of fucking things up lol
@yupeiliu4383
@yupeiliu4383 7 жыл бұрын
An excellent video to learn Rust for C++ programmers.
@SiddharthKulkarniN
@SiddharthKulkarniN 5 жыл бұрын
What is I don't know C++
@Dweepnes
@Dweepnes 7 жыл бұрын
Suddenly lifetimes do not look so scarry.
@jonathanrowlands1147
@jonathanrowlands1147 7 жыл бұрын
Excellent talk. The speaker was clear and concise. I've dabbled a bit in rust but never really looked much into parallelism features. The qsort example is really neat. The || syntax threw me off for a minute before realizing that it is just a closure!
@lppedd
@lppedd 6 жыл бұрын
First time I read |_, _| I was like "what the fuck is that??". Than it becomes clear.
@ArpitAgarwal1
@ArpitAgarwal1 5 жыл бұрын
This was a great talk for c++ programmers(intermediate) to learn about rust basics. It made me understand how I can start using rust
@Al-wt5kf
@Al-wt5kf 5 жыл бұрын
This helps me to write better C++ code, well prepared presentation!
@melvyniandrag
@melvyniandrag 6 жыл бұрын
Great talk, I've been wanting to learn about rust for a while. I feel weird about these talks about language B at a language A conference, though. At the Scipy conference there is always a small crowd talking about Julia. Kind of weird I think.
@fungiside
@fungiside 7 жыл бұрын
Fantastic talk!
@thingsiplay
@thingsiplay 3 жыл бұрын
Listening to "Niko Matsakis" is just a joy.
@IvarsRuza
@IvarsRuza 6 жыл бұрын
Nice talk! Liked it a lot. I thought at one moment Niko will have heart-attack! Niko was so thrilled about Rust.
@informant09
@informant09 6 жыл бұрын
Really, really good talk !!
@mduckernz
@mduckernz 7 жыл бұрын
Excellent talk! :)
@distrologic2925
@distrologic2925 5 жыл бұрын
I really like this guys talks!
@DrewryPope
@DrewryPope 2 жыл бұрын
i love the early description of editions
@mybigbeak
@mybigbeak 5 жыл бұрын
I watched this talk whwn it first came out. it was good to watch again now I'| more familiar with the language. and see it still taught me some stuff
@jianliuhu7882
@jianliuhu7882 6 жыл бұрын
Excellent Talk!
@cgoobes
@cgoobes 7 жыл бұрын
Wow, c++ needs the package manager library thing.
@alexandrpirogov2895
@alexandrpirogov2895 7 жыл бұрын
Conan.io is trying to fill this gap
@bit2shift
@bit2shift 5 жыл бұрын
You won't see adherence from embedded system developers.
@climatechangedoesntbargain9140
@climatechangedoesntbargain9140 5 жыл бұрын
vcpkg
@loomismeister
@loomismeister 4 жыл бұрын
I think the cargo system, combined with its build system and single compiler, is one of rusts biggest weaknesses.
@ThrashAbaddon
@ThrashAbaddon 4 жыл бұрын
vcpkg is one really good cross platform package manager. I'm using it on win10 and it works great. In two commands you can download c++ package and install it, and then just #include it inside visual studio. This is great for just checking out if some library is ok. Try it out. :)
@ThrashAbaddon
@ThrashAbaddon 4 жыл бұрын
You know it is a good talk when people interrupt you because they want to know more
@theplanebrain
@theplanebrain 7 ай бұрын
This is honestly, truly, mind blowing and amazing. Everything boiled down to what "you learned in Kindergarten". Just about.
@rafaelkss2009
@rafaelkss2009 6 жыл бұрын
Brilliant question made by 2nd guy. "Everything was a good idea back in the day". Now C++ syntax is garbage mostly due to retro compatibility and bad ideas.
@TheDuckofDoom.
@TheDuckofDoom. 6 жыл бұрын
Yeah catering to decades of old code can be quite an anchor. I like the epoch system described. Python should have pushed for the explicit use of #!/bin/python2 or ...python3 as a preferred style so the two interpreters can live on the same machine without the need for the user to call either of them to run a particular script. ( most 'nix machines already install the interpreters like this "/bin/python" just sim-links to one of them and the other must be used explicitly)
@evans8245
@evans8245 4 жыл бұрын
damn, i love it, i finished the book
@PaulTopping1
@PaulTopping1 Жыл бұрын
Interesting but wouldn't the C++ publish function pass the vector by reference? Not sure what publish does but surely you don't want to copy the vector.
@traister101
@traister101 7 ай бұрын
That wasn't the point of the example. The point was to demonstrate ownership. Publish wants to own the book. In C++ the book is copied and _that copy_ is owned. You could move the book into the function but that leaves the book variable you moved out of in a invalid state, yet nothing stops you from messing with it. In Rust using the original book variable after you moved it (transferred ownership in Rust terms) *is a compile error*. If publish should only read from the book both languages have similar behavior there, a reference to const in C++ or a borrow in Rust.
@totoplopp6630
@totoplopp6630 7 жыл бұрын
Who here just started coding and doesn't get any of this stuff but is still super fascinated too?
@psna70
@psna70 7 жыл бұрын
at 34:50, the for loop should be 'for elem in self.iter()', not just 'for elem in self'.
@daboross2
@daboross2 7 жыл бұрын
I believe this actually will work as it is, because IntoIter is implemented on `&Vec` such that it iterates over `&T`
@psna70
@psna70 7 жыл бұрын
IntoIter is not the same thing as Iterator. You need to call .into_iter(), .iter(), or .iter_mut() to actually create the iterator. How does the Vec, or &Vec keep track of where it is in the iteration? It doesn't, the iterator that .iter() creates does, however, so you can actually iterate.
@daboross2
@daboross2 7 жыл бұрын
Yes, I agree with you here, but the way a `for in` loop works is by calling IntoIter::into_iter then iterating the result. this is a no-op for things already iterators, and then makes it also work with &Vec, etc.
@daboross2
@daboross2 7 жыл бұрын
See play.integer32.com/?gist=d08c439348a3101ddfda76b1b0f9de2e&version=stable
@psna70
@psna70 7 жыл бұрын
David Ross yea I must agree actually, I was wrong here. I've always called the iter methods manually, so I guess I just assumed that for only worked on actual iterators.
@minecraftermad
@minecraftermad 4 жыл бұрын
Ok but is the rust compiler turing complete?
@TheMrKeksLp
@TheMrKeksLp 3 жыл бұрын
Rust has proc macros which allow you to modify subgraphs of the AST at compile time. A bit better than just "turing complete"
@TheDuckofDoom.
@TheDuckofDoom. 6 жыл бұрын
Sounds snazzy. Uphill battle though, there is a good chance it will be overtaken by C++17 or 20 though as the C++ team has been adding many modern features that compete in the same realm, and Rust is not that different. (ie HDVD vs Blueray) Also Rust must become established which means splitting the existing pie into yet smaller pieces, getting into education, proven compiler reliability and efficiency etc.. Meanwhile C++ has the established bit in the bag, with well-refined compilers and all the works, ++ only needs to add a few features to match a most of what Rust can do. (as long as the needed features get in to one of them its a win, I don't really care which name is on the language)
@syntaxed2
@syntaxed2 6 жыл бұрын
Rust is 2 years old...pretty sure people said the same thing about C++ at such early life .
@ianhamilton350
@ianhamilton350 5 жыл бұрын
The rust compiler uses LLVM as the back end so it's at least as reliable and efficient as Clang
@climatechangedoesntbargain9140
@climatechangedoesntbargain9140 5 жыл бұрын
actually C++ will even have better compiler enforced safety: while rust only has unsafe, C++ will gain more granular tags, which allow more specific control
@heater5979
@heater5979 4 жыл бұрын
Yes, it's great to see C++ adding modern features. Type deduction, lambdas etc. But good grief, C++ has become massively complex. With a syntax and semantics so huge contorted that I don't believe there is a single person in the world that knows and understands it all let alone how all all the parts work together. That's before we start talking about the standard library. Certainly the compiler writers don't, if they did their error messages would actually be useful. But anyway, I think you are wrong. Certainly you can add some more features to C++ to match a lot of what is in Rust, BUT I suspect it's impossible to add the most important feature of Rust to C++, the assurance of correctness and safety. The prevention of all those buffer overflows, use after frees, null pointer errors, use of uninitialized variables, memory leaks, data races, switch fall thoughs, undefined cases, etc, etc, etc. Sure you can achieve such safety in C++ if you try hard enough. Why not let the compiler do all that checking work for you? I'm not totally sure but I think it's impossible with the C++ syntax and would require changing the semantics so much it would fail to compile most existing C++ programs. Ain't going to happen.
@bytefu
@bytefu 4 жыл бұрын
@@climatechangedoesntbargain9140 Yeah, great. And I will be a much better programmer in the future, so hire me, Google. I am tired of that never ending talk about what C++ will have in the future. It is complicated enough already, and it lacks basic safety features that Rust has _right now_, not tomorrow. I was shocked when I checked the C++ vector example and it compiled without even a warning, and then of course crashed when run. Come on man, stop living in a dream. How much time is needed to not only implement all the safe features for C++ but also to standardize them? Waiting another 10 years does not look like a viable option to me. And even if it all comes out tomorrow, what's the point? C++ will still have an enormous historical baggage that you cannot easily throw away, so it will never be as good as a language that was developed from scratch with C++ problems in mind.
@TechnologyRules
@TechnologyRules 4 жыл бұрын
Talk start at 0:55. Thank me later
@helkat9876
@helkat9876 5 жыл бұрын
C++ suuuucks
@TheamxxL
@TheamxxL 4 жыл бұрын
A C++ is not guilty for being used by noobs.
@ianakotey
@ianakotey Жыл бұрын
​@@TheamxxLThis is just as problematic as the original comment. Everyone is a noob when they touch programming for the first time, no matter the language. So, you're saying C++ should "not be for noobs"?
@TheNovakon
@TheNovakon 5 жыл бұрын
19:49 - Clone and copy semantics in RUST is horrible idea. Especially when primitives are not moved... I've found std::move more viable.
@dynfoxx
@dynfoxx 4 жыл бұрын
You don't need to know or care if a type is copy. Since copy acts as a move just cheaper. I maybe wrong but it seems a lot more straight forward than having to worry about std::move.
C++Now 2017: Daniel Pfeifer “Effective CMake"
1:27:02
CppNow
Рет қаралды 177 М.
The C Programming Language is Over 50 Years Old, So Today I Learned Rust
8:14
NO NO NO YES! (50 MLN SUBSCRIBERS CHALLENGE!) #shorts
00:26
PANDA BOI
Рет қаралды 102 МЛН
Crust of Rust: Lifetime Annotations
1:33:23
Jon Gjengset
Рет қаралды 202 М.
When the details matter - Niko Matsakis - EuroRust 2023
30:57
EuroRust
Рет қаралды 3,8 М.
[UPDATE] Mojo Is Faster Than Rust - Mojo Explains More
52:09
ThePrimeTime
Рет қаралды 230 М.
Traits and You: A Deep Dive - Nell Shamrell-Harrington
22:09
Rust Belt Rust Conference
Рет қаралды 38 М.
Rust's Witchcraft
9:18
No Boilerplate
Рет қаралды 170 М.
8 deadly mistakes beginner Rust developers make
14:14
Let's Get Rusty
Рет қаралды 155 М.
Rust Data Modelling Without Classes
11:25
No Boilerplate
Рет қаралды 159 М.
Niko Matsakis - Rust: Putting Ownership to Use
38:19
Curry On!
Рет қаралды 17 М.