Building on an unsafe foundation - Jason Orendorff

  Рет қаралды 8,154

Rust Belt Rust Conference

Rust Belt Rust Conference

Күн бұрын

Пікірлер: 18
@UberOcelot
@UberOcelot 6 жыл бұрын
This is my favorite Rust talk that I've seen. I also really like one's one the more advanced language features, but when it comes to selling the idea behind Rust, talks typically show of the power of "safe-land." This is the first time I really felt a strong intuition of how Rust safely builds it's abstractions up.
@alwaysradical1613
@alwaysradical1613 2 жыл бұрын
Dangers of C++ starts at 5:10; Unsafe Rust intro starts at 14:47; Title slide at 19:50
@macroscalequantumsys
@macroscalequantumsys 6 жыл бұрын
Fun and useful talk, thanks!
@alwaysradical1613
@alwaysradical1613 2 жыл бұрын
Wait, what happens if vector length is already usize::MAX, and then we push again? I don't see how the code presented deals with this potential problem.
@mbartelsm
@mbartelsm 2 жыл бұрын
It panics, it said so in the docs. Push panics if pushing would overflow a usize integer.
@jubalrahl
@jubalrahl 5 жыл бұрын
"Why do we even have that lever?!" Lmfao ^_^
@haystackdmilith
@haystackdmilith 2 жыл бұрын
The difference is in HOW you write an unsafe code. If the programmer has to do something too advanced for the Rust compiler to comprehend, you can take over control. There's nothing wrong in calling unsafe function that has no flaws (aka is "pure")
@YouCodeThings
@YouCodeThings 6 жыл бұрын
Fantastic
@RobertLugg
@RobertLugg 6 жыл бұрын
What was going on at the very end when he mentioned the book?
@NTmatter
@NTmatter 5 жыл бұрын
O'Reilly discontinued their PDF offerings. Your only options are the Print Edition, Kindle Edition, and Safari Subscription.
@WillianMolinari
@WillianMolinari 6 жыл бұрын
The real talk starts at 5:10 :)
@rustbeltrust
@rustbeltrust 6 жыл бұрын
If you think the part before that wasn't relevant, you might have missed the metaphor ;-)
@BentRasmussen
@BentRasmussen 6 жыл бұрын
Better but now you depend on a huge ecosystem of crates with unsafe sprinkled all over. Not just the stdlib.
@VivekYadav-ds8oz
@VivekYadav-ds8oz 3 жыл бұрын
As a Rust learner, I think it is being sold wrongly. The word "undefined behaviour" is thrown around too casually. The CPP conference people tend to abstract away hardware and concrete implementations, hence they just label anything not specified by the C++ specs as "undefined behaviour" because they cannot be sure how the implementations will handle such situations. But, almost all popular compilers do the most reasonable thing when it comes to these situations. Printing uninitialised memory will print whatever bits were stored in its place, overflowing an integer will result in it wrapping down to the smallest storable number, etc. This is not something CPP programmers would worry about while coding. This is fear-mongering. I fear I'm getting myself into a community full of these people, but damn the promise is too great not to give it a shot, and so far, I like it.
@AbelShields
@AbelShields Жыл бұрын
I'd like to respond to that: in all these situations, is wrapping behaviour and printing undefined bits what you want? You can achieve all of that in Rust too, but it forces you to explicitly say that that behaviour is what you want. If I'm summing positive integers in an array and get a negative result, is that what I wanted, or will this cause a problem with some assumption I make further on? Rust doesn't forbid this behaviour, there's a wrapping add, which let's you say that you're sure you want this behaviour. If you don't want to worry about that every time, there's specific wrapping integer classes that will do that every time if that's what you want. You can read uninitialized memory, or even memory from an arbitrarily specified pointer inside an unsafe block. I feel like the purpose of Rust is to help you not get bitten by these things when you're not expecting it, making it easier to do the right thing.
@Neme112
@Neme112 6 ай бұрын
All those things *are* undefined behavior, by the standard.
@megumin4625
@megumin4625 3 жыл бұрын
So basically, don't use C/C++ lol
@origamibulldoser1618
@origamibulldoser1618 3 жыл бұрын
"You forgot to initialize the variable". Lol. Close. Noob.
Becoming a Contributor - Chris Krycho
30:47
Rust Belt Rust Conference
Рет қаралды 1,7 М.
Rust NYC: Jon Gjengset - Demystifying unsafe code
29:25
Win This Dodgeball Game or DIE…
00:36
Alan Chikin Chow
Рет қаралды 30 МЛН
Will A Guitar Boat Hold My Weight?
00:20
MrBeast
Рет қаралды 224 МЛН
Bike Vs Tricycle Fast Challenge
00:43
Russo
Рет қаралды 87 МЛН
Traits and You: A Deep Dive - Nell Shamrell-Harrington
22:09
Rust Belt Rust Conference
Рет қаралды 39 М.
Understanding Ownership in Rust
25:30
Let's Get Rusty
Рет қаралды 257 М.
Writing Unsafe Rust
15:26
Let's Get Rusty
Рет қаралды 26 М.
Rust is not a faster horse
11:37
No Boilerplate
Рет қаралды 326 М.
Considering Rust
1:03:57
Jon Gjengset
Рет қаралды 191 М.
Rust: A Language for the Next 40 Years - Carol Nichols
55:08
ChariotSolutions
Рет қаралды 359 М.
Matthias Endler - Idiomatic Rust
24:45
Rust
Рет қаралды 25 М.
5 Strong Opinions On Everyday Rust
7:16
Logan Smith
Рет қаралды 62 М.
Polonius: Either Borrower or Lender Be, but Responsibly - Niko Matsakis
35:29
Rust Belt Rust Conference
Рет қаралды 17 М.
Win This Dodgeball Game or DIE…
00:36
Alan Chikin Chow
Рет қаралды 30 МЛН