Rust makes you feel like a GENIUS

preview_player
Показать описание
A 10-minute lightning talk explaining why I think Rust is the most loved language.

CREDITS & PROMO
My name is Tris Oaten and I produce fast, technical videos.
Рекомендации по теме
Комментарии
Автор

ERRATA
- Example at 5:51 is incorrect: Missing mut on line 1. Lines 6 and 7 are legal and compile. You need to take a mut ref to neuromancer in another var to cause a compile error.
- Also the 2nd editor is molly, but in line 7 it's dave.
- Rust can only deal with out of bound errors at build time when you are dealing with constant values. Unfortunately, most of the time, these errors happen in cases more complex that the compiler is not able to detect at compilation time. (though runtime errors are still better than python, eg the len is 3 but the index is 6)
- 7:09, the error says the value `vec` was moved, when the variable is actually called `users` in the code.
- 5:00 `name` is a reference, `&str`, which implements the `Copy` trait. So it is implicitly cloned and not moved. I should have to used a `String` in line 1.
- 9:22 "IS EQUIVILANT TO" should say "IS EQUIVALENT TO"

NoBoilerplate
Автор

The perfect recipe for making anyone feel like a genius is to give them problems to solve, constraints they have to work within, and a good selections of tools. Puzzle games have been following this formula for years, but Rust also does this exceedingly well.

theRealPermagreen
Автор

Hi. Rust developer here. Your compile time error on an out of bounds array access is only possible because that is a static array. It's a very cherry picked example as this scenario is rather rare. With Vec you would also get a stack trace at runtime if you were not using .get(n) and checking the Option. While rusts error messages are great and even its stack traces are very clean it is worth being careful to set correct expectations. It is not magic.

Furthermore language communities (and the entire discipline of software development as a whole) has a rampant evangelism problem. It's great to be enthused but be enthused with caution please.

Yogii
Автор

You're like Bob Ross of programming: "Just look at this little happy error" 😂

adileturaimov
Автор

This is exactly how I felt when I started writing rust a year ago. Coming from Java, the programming experience I was accustomed to was that the first time I run my project (or the first time after a big commit), there is a 95% chance that my code will immediately crash due to some obvious oversight. With rust it's the complete opposite - if the linter (rust-analyser) doesn't complain, there is 95% chance that my code WILL run. It is an absolutely refreshing feeling that no other language has ever allowed me to experience.

scheimong
Автор

I guarantee that I will still sometimes feel like an idiot regardless of what language I'm programming in.

BlunderMunchkin
Автор

I started my first Rust project the other day, and while I still have some things to learn about the language, but between the documentation, error messages, cargo, rich type system, Ferris the crab, borrow checker among other features, it feels like a dream.

Hwyadylaw
Автор

Your example with the „neuromancer“ manuscript will not compile, but not for the reason you stated.
In order for line 6 to compile, your neuromancer variable needs to be declared as mutable on the first line.
If line 6 compiles, line 7 will also compile, since the variable is only mutably borrowed until the „edit“ function returns. In order for it to not compile, you would need to store a mutable reference to the „neuromancer“ variable before calling the „edit“ function.

severinweigold
Автор

I've been writing lots of rust over the last few weeks, having dabbled and written a few things about a year earlier. It definitely gives that "this is gonna work" feeling; and furthermore if you actually pay attention to what the compiler is telling you, you often stop making the mistakes altogether.

microcolonel
Автор

and this is why you can easily get addicted to programming in rust

ItzKernel
Автор

Python - "list index out of range"
He - "Python would not tell me what's wrong here"
Python - "Am i a joke to you?"

darkchoclate
Автор

I don't know anything about rust, I am a web developer and I work with - you guessed - JavaScript on a daily basis. I am amazed at how you explained everything so fluently and slowly. As a result, I could tell what was happening at minute 7:00, without having ever touched any rust.
You made me feel like trying Rust. I believe I will fall in love with it. Please don't stop posting

nxter
Автор

Never thought I would watch rust video as bedtime story 😂

Nice voice and storytelling sir!

Btw, rust compiler sometimes seems like a mini AI.

thearyanahmed
Автор

I don't know if rust would have ever entered my radar if not for your video, started writing rust a few weeks ago and have been loving it since.

dorjegilfillan
Автор

The only thing missing is for the ecosystem to catch on. We still have a massive lack of popular libraries/packages and frameworks in comparison with C++ and Java. While rust is easier for developers to write code, the lack of libraries and frameworks is a tough pill to swallow if you want to use rust for a bigger commercial product. It becomes so time consuming to develop certain functions from scratch. And if there is library or framework alternative available for rust, the lack of documentation, tutorials or community answers can be very frustrating. I really hope that within the next 5-10 years the ecosystem catches on. Then again, being in such early days is a big opportunity to help shape the future of rust.

Hobbitstomper
Автор

Last week I subscribed, happy to see another rust video. Liked it

Haiderali-qdjy
Автор

I can see how, coming from JavaScript, Rust would seem miraculous, but we've had strongly-typed, compiled languages, and compiler linting for quite some time. A comparison of Rust's advantages over Java, C#, C++, etc. would be a lot more useful.

RyanRussonDev
Автор

Rust is such a cool language. I've worked with a lot before, but Rust is by far my favorite. Also, another very cool aspect about Rust is because it's so safe, you can use code assistants like Copilot with confidence everywhere. Using it in other languages like JS is fine after checking if it doesn't crash, but the Rust compiler immediately tells me if it's wrong. Great video btw!

OwO-.
Автор

2:50 It's worth noting that *most* Rust errors are compile-time errors. Some cannot feasibly be checked at compile time (eg. accessing values within a while loop) and will generate a runtime errors.

let array: [i32; 10] = [0; 10];
for i in 1..11 {
println!("{}", array[i]);
}

this will compile just fine, although it will inevitably cause a runtime error.

themichaelw
Автор

still havent written any line of Rust and I'm already loving the "ownership" concept

martinslns