The Darkside Of Rust

  Рет қаралды 89,541

ThePrimeTime

ThePrimeTime

11 ай бұрын

Recorded live on twitch, GET IN
/ theprimeagen
Article: / the-dark-side-of-rust-...
MY MAIN YT CHANNEL: Has well edited engineering videos
/ theprimeagen
Discord
/ discord
Have something for me to read or react to?: / theprimeagenreact

Пікірлер: 390
@daniellundqvist2926
@daniellundqvist2926 11 ай бұрын
Personally i grasped pointers in C/C++ much faster than I grasped the borrow/owner thing. I never understood why pointers were hard to grasp as a concept for other people, it felt very intuitive for me.
@ea_naseer
@ea_naseer 11 ай бұрын
stores address simple. address is where value is stored. pointers were where I first learned you can pass functions as values.
@mbunkus
@mbunkus 11 ай бұрын
Curious question: did you learn about both concepts roughly at the same time, or did you learn about one (which one?) a lot sooner than the other?
@VojtaJavora
@VojtaJavora 11 ай бұрын
I had some problem with pointers until I programmed some assembly where it finally hit me that you can just store an address of a cell in a cell (this was 8051, addresses have 8 bits, so by cell I mean RAM byte).
@anonymousalexander6005
@anonymousalexander6005 11 ай бұрын
Because most people start their programming journey in really high level languages from some sort of block language like for high-school robotics to stuff like Python and JavaScript, and then when they decide to learn C++ they try to go at it without help because they are overconfident even though it arguable has the best learning resources at this point, finally after learning basic C++ and getting overconfident with that, because it’s the “hard” language, you learn a language like Rust, which has relatively obscure learning resources, and they get confused at simple things like references or useful iterators. Moral of the story is that being self-taught programmer is rarely being a well-rounded software engineer, usually skipping all theory and never touching assembly or C99 EDIT: some ppl are butt hurt so changed the phrasing just in case they aren't English-fluent.
@lmnts556
@lmnts556 11 ай бұрын
It's all in the way it's explained. If the teacher can't explain it simply so that the students can understand he does not understand it himself... Simplicity is key.
@captainfordo1
@captainfordo1 11 ай бұрын
I have zero interest in writing Rust but still watch these videos.
@frittex
@frittex 11 ай бұрын
your interests are wrong then
@TheDanVail
@TheDanVail 11 ай бұрын
Drink the kool aid. Join the cult. Give up your ownership of your life.
@RenderingUser
@RenderingUser 11 ай бұрын
But have you considered rewriting your interests in Rust?!?!
@itsjustboarsley
@itsjustboarsley 11 ай бұрын
Lmao same
@smthngsmthngsmthngdarkside
@smthngsmthngsmthngdarkside 11 ай бұрын
You should write in rust
@NphiniT
@NphiniT 11 ай бұрын
I think the reason Rust is not easy for beginners is because most resources teach it by comparing with other languages instead of just teaching Rust
@RenderingUser
@RenderingUser 11 ай бұрын
The book is pretty decent tho I haven't quite come across stuff from other languages much. Or at all if my memory serves me correctly.
@NphiniT
@NphiniT 11 ай бұрын
@@RenderingUser I follow the book too. But Rust courses made by people, whether on Udemy or KZbin. Ironically, I'm thinking of making videos now comparing C and Rust lol. But that will clearly not be for beginners. I mainly want to focus on what it takes to make C as safe as Rust.
@coderaiders-yt
@coderaiders-yt 11 ай бұрын
I think it depends on whether you’re coming from a language like Python or JavaScript vs something like C perhaps. I started rust from higher level languages and never had to think about managing memory before that.
@grawss
@grawss 11 ай бұрын
@@coderaiders-yt Interesting. I came from Python and a little Autohotkey. In AHK you could empty a variable by assigning to nothing (var :=). You didn't need to, but I liked knowing what resources I was using at all times. Python was annoying because I didn't need to do that for the most part, so it felt like I didn't have control.
@RenderingUser
@RenderingUser 11 ай бұрын
@@grawss :o. I also sort of came from python and auto hot key Though i used auto hotkey very little. Didn't have much use for it. Also some gamedev with gdscript Currently learning rust
@villuna_
@villuna_ 11 ай бұрын
4:57 actually 🤓 RefCell doesn't store values on the heap. RefCell contains an UnsafeCell which is just a wrapper around T.
@ThePrimeTimeagen
@ThePrimeTimeagen 11 ай бұрын
Okay, good to know In general I still like my if it's boxed it's probably on the heap approach
@Andrew-jh2bn
@Andrew-jh2bn 11 ай бұрын
You could be forgiven for that misconception since in my experience it almost always is used with an rc pointer, which is heap allocated.
@SimonBuchanNz
@SimonBuchanNz 11 ай бұрын
Box/Rc/Arc: smart pointers/boxes. *Cell: single threaded Mutexes. Honestly though, it's so rare that you want to use Cell (or UnsafeCell!) I feel they should just add a MutRc and MutArc wrapping Rc and Arc, just to make them a bit less scary looking.
@thekwoka4707
@thekwoka4707 11 ай бұрын
Isn't the T there on the heap, but the cell is on the stack?
@SimonBuchanNz
@SimonBuchanNz 11 ай бұрын
@@thekwoka4707 who are you talking to? If it's me, then no, Rc is an Rc storing a RefCell on the heap (and a ref count), and a RefCell directly contains a T (and bookkeeping on if it's borrowed), so the T is on the heap in that case.
@user-ky4pn4xc5w
@user-ky4pn4xc5w 11 ай бұрын
"I think I can beat Ruby in a foot race" 😂
@sirhenrystalwart8303
@sirhenrystalwart8303 11 ай бұрын
I actually think that the syntax of pointers in c is one of the most difficult parts, especially with how they conflate array syntax and pointer syntax.
@Leonhart_93
@Leonhart_93 Ай бұрын
Does it conflate it? I am not a C expert, but I know that an array variable is the memory address of the first element, and then you offset the element index by adding to it with [i]. So an array is a pointer address.
@mathijsfrank9268
@mathijsfrank9268 11 ай бұрын
I think what the article meant is that rust has a lot of ways of writing code in an elegant way, which makes it easy to read. Like iterator chaining, question mark errors, and match statements. Where it often gets very complicated (in my opinion) is when generics/macros are involved. I love them macros, just look at the generic VecX types of a crate like nalgebra-glm...
@grawss
@grawss 11 ай бұрын
Everything looks complicated when you don't know how it works. I got into this field late, but I agree with the chat you quoted, scope was harder for me than borrowing. Mostly because of OOP and abstraction getting in the way of what is otherwise a very simple concept, but that's why Rust is easy to learn for true* beginners. *by "true" beginners, I mean people who are learning for themselves. The hungry type of person. I often see people getting their hand held through the process, and they act very differently than the ones who would voluntarily start up conversations about work/programming because they're excited to learn the concepts and ideas.
@avnishjha7876
@avnishjha7876 11 ай бұрын
Its always the half baked knowledge folks writing medium articles smh
@CamembertDave
@CamembertDave 11 ай бұрын
9:00 - I recently was wrestling with this and ended up having to use unsafe blocks with mutable static variables to do what I wanted. It felt wrong, but I was able to accept it when I realized the reason Rust has those features is to accommodate things like what I was trying to do.
@grim.reaper
@grim.reaper 11 ай бұрын
8:30 I believe CSP model is better for concurrency. Communicating sequential processes is a well thought out model imo
@FJL4215
@FJL4215 11 ай бұрын
3:16 - "There's definitely an Arc..."
@MrJdsteinhauser
@MrJdsteinhauser 11 ай бұрын
When I was weighing languages to use on a project several years ago, I ended up ruling out Rust and Go because of their executable size (> 1 MB). I needed the smallest binary I could get, and I just couldn't get it small enough from Rust or Go. I ended up using C++ to get the smallest binary I could (~40 kB). I'd like to run that experiment again though.
@dynfoxx
@dynfoxx 11 ай бұрын
Make sure you have Rust Debug data stripped if you want a small binary. If you didn't know there is a guide to shrinking Rust Binaries.
@MrJdsteinhauser
@MrJdsteinhauser 11 ай бұрын
@@dynfoxx I actually didn't know that! I'll go searching for it. Thanks!
@dynfoxx
@dynfoxx 11 ай бұрын
@@MrJdsteinhauser look up "How to minimize Rust binary size". While Rust is normally larger then C and C++ most of the size is due to Debug info and strings. Though due to how generics work it can also cause code bloat. Though it should not be substantially larger for similar programs.
@timedebtor
@timedebtor 11 ай бұрын
The first language that I took seriously in school was Ada. I think that languages with rich type systems require a different style of learning than interpretive through it at the walls languages. It's harder to learn on your own languages that leverage a lot of computer science contextual knowledge.
@dealloc
@dealloc 11 ай бұрын
The only "hard" thing in Rust for me is data structures with circular references, like for LinkedList. It requires a bit more indirection in Rust in order to make the compiler happy (even though what you are trying to do would be perfectly safe, the compiler can't guarantee some of this). The easiest solution is to Box those values, but not always the best approach and doesn't work in all cases. Then you could use Rc and RefCell but those also comes with great responsibility as they could leak memory if not handled correctly. Oh and now you want synchronization across threads and handle deadlocks on mutable data structures; and because the built-in std library doesn't provide the most intuitive APIs for this (or lacking some features), you end up with using something like parking_lot to deal with that. I find that these things are a bit easier to grok in languages like Zig, even though it's more likely that I'd make a mistake for more complex cases.
@maticz3923
@maticz3923 11 ай бұрын
For circular stuff you want to use Weak
@jchevertonwynne
@jchevertonwynne 11 ай бұрын
​@@maticz3923 you could, but there's reasons why the stdlib linked list doesn't do that and chose to use raw pointers
@diadetediotedio6918
@diadetediotedio6918 11 ай бұрын
Linked lists are not a circular references structure
@phoenix-tt
@phoenix-tt 11 ай бұрын
@@diadetediotedio6918 Double Linked Lists kind of are
@tourdesource
@tourdesource 11 ай бұрын
Linked lists are only performant in theory, cache misses make it slower than dynamic arrays for pretty much anything.
@EthanBradley1231
@EthanBradley1231 11 ай бұрын
I think ownership and borrowing can be tough for beginners who don't know what kinds of mistakes those systems prevent you from making. If it isn't motivated by the pain of programming in an unsafe language then it might be easy to wrap your head around but hard to understand why it's needed at all.
@quelchx
@quelchx 11 ай бұрын
When I hear programmers say they program in Rust it reminds me of all linux distro hoppers saying I use Arch btw. Unno why -- but I wanted to share my input.
@tyrellnelson
@tyrellnelson 11 ай бұрын
I find rust quite easy to refactor... I can fearlessly move multiple files around and separate a whole bunch of functions and types out into different modules.. Then just hit compile and the compiler and rust-analyser will walk me through fixing everything... Library code can be hard to read but a lot of application code with the expressive type system can be quite easy to read or at least understand an overview of how things work
@jeezusjr
@jeezusjr 11 ай бұрын
When I figured rust was not for me is when I went and looked at the ripgrep code base. I use that tool everyday. The code looks a lot better now then it did five years ago though.
@riccardoshrives5881
@riccardoshrives5881 11 ай бұрын
2023 is the year of the linux desktop
@lmnts556
@lmnts556 11 ай бұрын
Probably not lol
@isodoubIet
@isodoubIet 11 ай бұрын
Idk call me when linux figures out us international keyboards
@ImranSheikh-kg4qd
@ImranSheikh-kg4qd 11 ай бұрын
Let me share my experience with rust readability, I am working with js/ts last 3 years and still struggle with library code, but on rust its not more than 6 months, i am not even that much fluent in rust , but man o man i love reading library code. I don't know why but it feels good to me...your turn
@ThePrimeTimeagen
@ThePrimeTimeagen 11 ай бұрын
Everyone loves writing code
@dmitry.shpakov
@dmitry.shpakov 11 ай бұрын
2:44 "... crash my hand ..." For this case you have MISRA, btw
@linusdannull1247
@linusdannull1247 11 ай бұрын
8:42 Shared mutable data is the root of all evil
@RuslanKovtun
@RuslanKovtun 11 ай бұрын
When talking about whether or not Rust is for beginners we have to state what level of expertise we are looking for as a result. If we want to be able to use some libraries and make some simple job done is one thing. If we are willing to cross boundaries of unsafe Rust where strong knowledge of UB is required, there where the fun begins.
@Muaahaa
@Muaahaa 11 ай бұрын
I felt borrowing was harder for me because I was used to doing things in other languages that were not allowed in Rust. I needed to change my mental model of memory (which was a big plus).
@pesterenan
@pesterenan 11 ай бұрын
My god, I was watching this and missed the "I'm VSCode" part, and now I'm dying here HAHHAHAHHA
@alexandersemionov5790
@alexandersemionov5790 11 ай бұрын
The way you pronounce Rust analyzer makes me smile a bit
@user-bb4km1uj3o
@user-bb4km1uj3o 11 ай бұрын
Gives me butterflies
@unhackablew00t
@unhackablew00t 8 ай бұрын
I did less than a week of python before switching to learning Rust. Rust is nice. I did bang my head against the brick wall of the borrow checker and figure out how to get things to work how I wanted too, and realised it was because I was trying to code like "things" are objects like OOP i guess, or how i thought of OOP, but it took me just thinking about it nice and hard on a road trip in the passenger seat before i finally "got" it and then it was much easier.
@Yupppi
@Yupppi 5 ай бұрын
Rather offtopic but I think the biggest issue with learning C today is the part where everything teaches you to use scanf to get input and by now you know it's not a good thing to do, and then you find yourself struggling as a beginner to make user input work smoothly in other ways. And when you mark a string, or more like char[] as const and C just lets anything to mutate it freely and you're in a shock and question what const means. But I really agree about borrow and ownership. It felt really intuitive to me after trying to get rid of unnecessary copying in C++ to write a bit better code. And I guess after hearing a lot of C++ people talk about how the mutability and copying and ownership _should_ work, it seemed like Rust was that. But I agree hard on Rust's strings being just stupid. And all the methods that return different string types. And the whole syntax on creating and defining strings.
@FaZekiller-qe3uf
@FaZekiller-qe3uf 11 ай бұрын
I read The C Programming Language before reading "The Rust Programming Language". My first programs were written in C, but I'm most confident in Rust. I do understand Rust's ownership and borrowing rules. The first thing I tried to write in Rust was a Unix shell. I have now written more complex things jn Rust and am currently writing a Discord bot and a library for interacting with KZbin's "youtubei" API.
@FaZekiller-qe3uf
@FaZekiller-qe3uf 11 ай бұрын
Rust was perfectly fine for me as a newer programer.
@principleshipcoleoid8095
@principleshipcoleoid8095 10 ай бұрын
5:09 well you can use Arc instead of Vec to speed it up somewhat. When tge data is not going to grow and isn't goint to mutate and you just need a bunch of things to know about it
@regbot4432
@regbot4432 11 ай бұрын
Coming from C++ through rust to zig and C, I realized that if you need to constantly debug your knowledge about the language, there is something wrong with the language. Sure If you already spent so many hours writing in such language that you are a chad then ok, but when I came from C++ and then started learning rust, I just said after sometime 'fuck it i don't want to go through such deep rabbit hole again'. However sometimes I get drawn into rust, because I see all those people around bathing in rustelitism and I envy...
@coderaiders-yt
@coderaiders-yt 11 ай бұрын
Do you mainly write C and Zig now?
@rallokkcaz
@rallokkcaz 11 ай бұрын
The memory allocation part is a lot more prevalent in async/multithreaded rust.
@rallokkcaz
@rallokkcaz 11 ай бұрын
The footprint is not that small compared to C and C++ in terms of binary size.
@rallokkcaz
@rallokkcaz 11 ай бұрын
The go part about concurrency is really true too.
@ccgarciab
@ccgarciab 11 ай бұрын
​@@rallokkcaz binary size can go down by tweaking, but it definitely is less of a priority than other aspects like performance.
@alexpyattaev
@alexpyattaev 11 ай бұрын
writing properly fast c++ is pretty difficult. a lot of smart pointer things in c++ are not zero-cost. c++ makes it really easy to accidentally make copies of objects, wherein c++ will automagically make copy constructors for stuff, especially where you do not want them. threading in c++ is just pure nightmare fuel if you want to go properly fast. so, c++ is theoretically faster, but reacing its speed ceiling is very hard.
@froggy3496
@froggy3496 11 ай бұрын
I swear this guy is about to convince me to learn rust and I was like 100% settled on focusing on go for years
@samadkhafi9211
@samadkhafi9211 11 ай бұрын
Learn Go first, it will take 15 days max to learn most of the language. Then go for Rust, if you really want the benefits of Rust. I am still struggling to make a working rust program. Maybe, because I give up easily.
@josemonge4604
@josemonge4604 11 ай бұрын
@@samadkhafi9211 You probably need to go for C++ first. Until I had a good grasp of C++ and its smart pointers, then I started making good progress with Rust. Plus it's a good idea to learn something like haskell as well to learn the functional programming part. The thing is Rust is like a Frankenstein made up from several different paradigms and concepts from different programming languages. And learning those makes it easier to learn Rust.
@irlshrek
@irlshrek 11 ай бұрын
Don't listen to these guys. Rust is it's own thing and you don't need to know anything else in order to read The Book
@samadkhafi9211
@samadkhafi9211 11 ай бұрын
@@irlshrek I am not saying learning Go will make learning Rust easy. I'm just saying that Go will probably take less time to learn. So, learn that first. It won't take much time.
@RenderingUser
@RenderingUser 11 ай бұрын
@@samadkhafi9211 start out with small projects then. I stated with a simple terminal program Now I'm currently working on a full tui application. After that imma go use wgpu
@ymi_yugy3133
@ymi_yugy3133 11 ай бұрын
For new coders a smooth learning curve is crucial. This makes Python and JavaScript such compelling choices. It's easy to get started and get impressive results quickly, that motivate people to keep going and the languages and their ecosystems provide the depth that allow people to keep going. Making anything that isn't completely trivial in Rust is a lot harder. I don't think people can appreciate the pain the borrow checker inflicts on you if you haven't felt the pain of memory leaks.
@hughmanwho
@hughmanwho 11 ай бұрын
I find ownership and borrowing simple idea BUT it's a lot of overhead to constantly have to think about
@botondhetyey159
@botondhetyey159 11 ай бұрын
I started with C/C++ at university, but at work, I only do JavaScript. Rust is not particularly hard for me, definitely simpler for a big project then C or C++. But I do have plenty of functional programming experience from uni, I think that helps a lot.
@andythedishwasher1117
@andythedishwasher1117 11 ай бұрын
That was a pretty sick NPM/leftpad dual burn.
@vids4mee
@vids4mee 11 ай бұрын
"hold on new asmongold cooking video just dropped" i feel like i'm in the right place lmao
@principleshipcoleoid8095
@principleshipcoleoid8095 10 ай бұрын
7:28 sadly Bevy on MacOS has a memory gobbling problem. It does free the memory when you turn it off, and isn't happening on WASM builds, but it's still annoying
@genericdeveloper3966
@genericdeveloper3966 11 ай бұрын
Yeah I'm with you. Rust code can get hard to understand especially when traits + generics get involved. Not to mention to implement or extend a library.
@jjones503
@jjones503 11 ай бұрын
"I Don't See My Nipples" - Professional Programmer
@skrundz
@skrundz 11 ай бұрын
I built a super simple rocket server that just renders a tera template; it takes 13 minutes to cross compile to x86 linux from my M1 MBP lol
@TheBlackClockOfTime
@TheBlackClockOfTime 11 ай бұрын
Okay ngl I thought this was going to be about the PC game Rust. And I had some really dark expectations for some reason. Carry on.
@Robert-ht5kd
@Robert-ht5kd 11 ай бұрын
Apart from long compile time, the article doesn't contain real flaws of Rust, like very unreadable syntax. For example pub fn execute(&self, f: F) where F: FnOnce() + Send + 'static, { let job = Box::new(f); self.sender.as_ref().unwrap().send(job).unwrap(); }
@kurt7020
@kurt7020 11 ай бұрын
Amateur. You can stuff at least 2 more generic types, another explicit lifetime, at least 3 question mark operators, and a closure in there. lol.
@Robert-ht5kd
@Robert-ht5kd 11 ай бұрын
@@kurt7020 Say this to Steve Klabnik and Carol Nichols authors of "The Rust Programming Language", because that code is from their book, genius. By any chance, are you Tom?
@AlexanderHyll
@AlexanderHyll 11 ай бұрын
Am I damaged or is this kinda readable? Think its way worse when you run into convoluted trait objects in multiple levels with higher order trait bounds making it feel like chasing inheritance. Broke my brain twice figuring out Actix extractors (although I love them).
@Robert-ht5kd
@Robert-ht5kd 11 ай бұрын
@@AlexanderHyll OK, for you it is readable, for me it is waste of time to try figure out Rust code. I can use easier languages.
@kurt7020
@kurt7020 11 ай бұрын
@@Robert-ht5kd XD
@SebastianSipos
@SebastianSipos 11 ай бұрын
I've found harder to learn, but not because of the borrow checker and ownership, but by simply the lack of knowledge how to piece things together and have a decent architecture. Like what's idiomatic? How to pass a damn sqlx transaction to several functions (&mut PgTransaction)? etc I usually ask chatgpt if a bit of code is idiomatic.
@monkev1199
@monkev1199 11 ай бұрын
Yeah this is partially why I say Rust punishes bad architecture. Architecture is very important to consider.
@SebastianSipos
@SebastianSipos 9 ай бұрын
@@monkev1199 exactly but it doesn't show you the way. If you want to use a rust library, it's documentation include a basic example or a very complex one, or nothing. You have to understand all the Rust concepts with like Send and 'static and other things and as a newcomer, even if I walked the Rust book and docs, coming from a dynamic language is hart to actually put those concepts into practice. I guess the learning curve is a bit steep in the begining.
@eaglethebot1354
@eaglethebot1354 4 ай бұрын
Ownership and borrowing is pretty simple. You define a variable in one place, and next time it appears in the code its consumed. If you use it multiple times in the file after definition then try throwing an & before the variable's uses to use a reference, if that doesn't work then clone. Then if you remember you can't immutably borrow a mut variable you're in business!
@careymcmanus
@careymcmanus 11 ай бұрын
Rust is great and I love it but there's a reason I program C# and python at my company and that is because rust is hard. Its easy when you understand it but there is a steep learning curve. I work at a company where the majority of people are not software folk but engineers of other descriptions. We choose python as language because thats what people know. Personally I love programming in rust and I think that if you learnt C for say embedded than rust is not hard. I learnt rust for embedded because c++ is insane on tiny microprocessors as dynamic memory is not a thing. If you are a beginner programmer (not in a job) than you should use the language that fits yours goals. Are you trying to get something up and running? use JS, TS, java, python. Are you trying to learn how computers work? use C, Rust, C++. There are great reasons and negatives for all languages and it depends what you care about. C is great if you care about predictable performance (as in gaurentees that something will execute in at most a certain amount of time, but you have manage dynamic memory) C++ is great if you care about optimal performance (Allows automated memory allocation and often has a garbage collector which has a cost) but mistakes are easy (mistakes are also easy in C, probably moreso) Rust is great if you want the benefits of C++ without the negatives (Theree's no garbage collector because the language has compile time memory safety checks). THe downside being there is a steep learning curve to rust. JS is bad don't use it Typescript is better because types are great and if you are doing web stuff then its the way to go, find a framework that supports typescript out of the box and go ham. python is also great! It needs enforced typing and I hate the significant white space but it is accessible. Python is great but to fully utilise its power make sure you use its packages, particularly numpy and pandas. Python is a low performance interpreted language but those libraries are written in compiled languages, I believe numpy is written in fortran.
@tourdesource
@tourdesource 11 ай бұрын
Garbage collection is very rarely used in C++ and certainly not standard.
@playea123
@playea123 11 ай бұрын
12:20 imho, it depends on why you want to learn programming. I think if you want to learn programming in an academic sense and want to really understand what’s going on under the hood, Rust is great because it is safer than C or C++. If you want to just build something and getting into programming as a path to achieve the goal, Rust is hard since it is low level and doesn’t have as big a community as languages like Python or JS where someone has probably already run into an issue you are facing.
@mannycalavera121
@mannycalavera121 11 ай бұрын
Your videos keep me sane
@MrSofazocker
@MrSofazocker 11 ай бұрын
I still find it hard to believe you cant infer types across a program, without types at all. Like why is an compiler not doing the "hard-work" of running each code each subsequentily for it to know if any infered type was used incorrectly and yell at you... Most of the time, you still have to find out the hard way at runtime if something breaks.
@riccardoshrives5881
@riccardoshrives5881 11 ай бұрын
I'm, VsCode.. I, am, VsCode! I, am - I AM VSCODE! I AM VSCODE, Dr. Han! I AM VSCODE!
@PS3PCDJ
@PS3PCDJ 11 ай бұрын
3:35 Better term would be "explicit" as in "one you know what each token means then it becomes painfully obvious"
@br3nto
@br3nto 11 ай бұрын
7:08 web assembly is like Java applets… where did they go?
@Yiyang_Kang
@Yiyang_Kang 11 ай бұрын
16:07 "Dereference and call the function that 'foo' points to after it has been typecast to a pointer to a function taking no arguments and returning void." (translated by ChatGPT)
@dankmersi4282
@dankmersi4282 11 ай бұрын
Not me thinking that Prime played Rust ...
@embedded_software
@embedded_software 11 ай бұрын
This article is so poorly written I can't even finish the video
@electron6825
@electron6825 11 ай бұрын
If it weren't for the spelling errors I'd have assumed this was chatGPT written 😂
@maticz3923
@maticz3923 11 ай бұрын
Whoever wrote this doesn't know shit about programming
@isodoubIet
@isodoubIet 11 ай бұрын
Maybe you just think that because you're not vscode
@minandychoi8597
@minandychoi8597 11 ай бұрын
ocaml is like python 2 and 3 in the same language with the whole jane street thing. it divides the already tiny ecosystem into two even tinier incompatible ecosystems with barely anything documented. NOT for anything remotely serious unless you just write ocaml 24/7 so you know the ins and outs and your way around it and all. practically a DSL for jane street though not technically (JDSL fr). i dabbled in ocaml before getting on the rust train and have NOT looked back. you’re really not missing out on much tbh
@aoeu256
@aoeu256 11 ай бұрын
What are the problems you got in OCAML? The problems this guy has with the types in RUST sound like the problems I had with types in Haskell... Its easy to build the wrong type for your program, you don't really know if you need a -> b, or a -> SomeMonad b, or whatever until its too late and I haven't seen refactoring tools that help me change code when I want to change the types of my program. I wonder what kind of problems I would get in Julia or Mojo or CloureTyped hmm...
@isodoubIet
@isodoubIet 11 ай бұрын
" practically a DSL for jane street thought not technically." I mean that's probably very true if uncharitable, ocaml would be just another dead language if not for them
@NieLL1
@NieLL1 11 ай бұрын
Speaking as a 31 year old dumbass with a social sciences background, learning Rust has been pretty manageable so far. I've recently finished reading The Book, and I watched the first 5 CS50 lectures and believe I understand enough of memory usage and the workings of the borrow checker. People that hype up the difficulty of learning Rust are actually doing a disservice because I've been postponing this endeavour for about a year just because people claim it's so hard, and in fact it's not been 'hard' at all. Of course I sometimes get confused about how to massage the code so the borrow checker is happy but that's simply due to inexperience with the language, not because it's hard to understand. Again, I picked up Rust without *any* maths or programming experience, after only 2 weeks of tinkering with Python, and am now doing Medium level Exercism exercises after about 6/7 weeks. If anything trait bounds and concurrency have been much more complex to grasp than ownership and borrowing
@evergreen-
@evergreen- 11 ай бұрын
Just curious, why does someone with social sciences background learn Rust? What use cases does it have for you?
@greglocker2124
@greglocker2124 11 ай бұрын
Rust is hard. It's cringe when people try to humble brag that it isn't. "I don't know why people say it's hard! I'm smart XDXD" 6-7 weeks is a long time to learn a language. It sounds like you are nowhere near done. Spending 2 weeks on a language is a long time - unless it's Python - which should take less than a day. It's so irritating to constantly read about someone doing some baby project going "iTz NoT tHaT HaRD gUysE!" And then they proceed to out themselves as a noob. It is so obnoxious to claim something is easy when you clearly don't even know what you don't know yet.
@NieLL1
@NieLL1 11 ай бұрын
@@evergreen- I'm very interested in OSS. Hope to be able to contribute at least with basic things in 12/18 months :)
@NieLL1
@NieLL1 11 ай бұрын
@@greglocker2124 I'm obnoxious, noob and cringe? sounds a lot like someone is struggling emotionally and lashing out online for no reason :) and on top of ugly disagreeable traits that person also struggles with reading comprehension. If you reread my message you'll see I said "it's been pretty manageable" and "not 'hard'". I also qualified myself as a dumbass with no technical background at all. But it seems you are not much brighter than I am because you're naively confusing the difficulty of a task with the time it takes to complete it (you don't know how long I can dedicate to the task a day or how busy I am everyday with family and other tasks etc). My suggestion would be to completely reassess your life choices as you are clearly not in a good place mentally right now. Have a good one!
@tourdesource
@tourdesource 11 ай бұрын
@@greglocker2124 I've been learning C++ for a couple years and I'm not even close to done. Must be great to be able to learn a language in a matter of weeks!
@connorskudlarek8598
@connorskudlarek8598 11 ай бұрын
There is a reason Rust and C/C++ are not for beginners... JavaScript, Python, C#, etc: "Grab bread, peanut butter, and jelly. Spread peanut butter on slice of bread. Spread jelly on another slice of bread. Put bread together with peanut butter touching jelly. Eat sandwich." Rust, C/C++, etc: "Go to cupboard. Grab peanut butter jar. Go to fridge. Grab jelly. Go to counter. Grab bread. Deposit all items to cutting board. Realize you forgot to grab a cutting board. Grab cutting board. Place cutting board in workspace. Deposit all items to cutting board. Grab 2 slices of bread. Realize you have the wrong kind of bread. Go to counter. Grab the right kind of bread. Go to cutting board. Deposit bread. Grab 2 slices of bread. Name the first slice bread0, name the second slice bread1. Hold the knife and spread the peanut butter on bread0. Realize you didn't get a knife to spread the peanut butter. Go to the drawer. Grab a knife. Deposit the knife to the cutting board. Grab the knife and spread the peanut butter on bread0. Use the same knife to spread jelly on bread1. Realize you didn't wipe the knife off first, so you're adding peanut butter into the jelly. Realize you don't have anything to wipe the knife off with. Go to the counter. Grab the paper towel. Deposit the paper towel to the cutting board. Wipe the peanut butter off the knife with the paper towel (stackoverflow: "use the bread's built-in function next time, you inefficient wasteful heathen! also, this was closed because it was tangentially asked 6 years ago"). Use the knife to spread the jelly. Put the knife down. Realize you don't have hands to put the bread together with. Invent hands. Put bread together. Grab the peanut butter. Grab the jelly. Grab the bread. Grab the paper towels. Grab the knife. Grab the cutting board. Put each thing away. Realize you put the cutting board and knife away without cleaning them. Clean them. Put them away. Realize the sandwich was on the cutting board when you cleaned it. Make new sandwich. Grab the sandwich, deposit it to the counter. Re-do the cleaning. Grab the sandwich from the counter. Open the jaw and bite the sandwich. After every bite, chew and swallow, until there is no more sandwich." Assembly: "First, gather yeast which will be used to make bread with..."
@tourdesource
@tourdesource 11 ай бұрын
Yet somebody has to code it all up in C/C++ before you can squeeze that sweet sweet Python one-liner.
@connorskudlarek8598
@connorskudlarek8598 11 ай бұрын
@@tourdesource exactly right. A bunch of giants, on their shoulders we stand. One day, when you're ready-become the giant.
@12MrRetro
@12MrRetro 11 ай бұрын
Main problem of rust for beginners - is no jobs for beginners. And all what you have, is Java, Python or JS
@cherubin7th
@cherubin7th 11 ай бұрын
I move to Rust, because I can understand it much better than Python. Python is like pseudo understanding, but everything is so hidden that when I try to use it, it never makes sense. C++ is impossible to comprehend to me and everything is ripped apart with the .h files. Java and Go were fine to read. IMHO
@user-ge2vc3rl1n
@user-ge2vc3rl1n 11 ай бұрын
The reason why python is undesirable to me is that you can write code in Python and not know which parts are efficient because of the C api and which parts are slow because its just python. This is something that you can know with experience but its a deal breaker for me. For instance, C# doesn't have this issue at all. You can write C# in any way you like and the only thing you have to care is how you solved your problem, not how the another API is dealing with it.
@sledgex9
@sledgex9 11 ай бұрын
It depends on where you started. You started with Python. If you had started with C or C++ you would have grokked header files. Personally, I can't grok how other languages can cope without headers. Aka having a split between interface/declarations and actual implementation. Especially for bigger projects. (for the programmer's reading comprehension. Not for compiler speed).
@aoeu256
@aoeu256 11 ай бұрын
Python devs think in data and/or behavior not really in types maybe, and Python code can be more dense (although not as dense as Haskell). You can introspect code with type inference too.
@aoeu256
@aoeu256 11 ай бұрын
@@sledgex9 You can have your IDE build an outline without the need of header files, also dynamic languages with introspection features you can loop over all functions in a certain module and print out their call definition using inspect, and you can store metadata like logged inputs/outputs inside a associative array to each function ask chatGPT for that.
@isodoubIet
@isodoubIet 11 ай бұрын
@@sledgex9 header files are a really crummy way to make that separation though. That said, if you're having trouble understanding C++ code because of that separation that to me just speaks to lack of experience with the language.
@anders3460
@anders3460 11 ай бұрын
The problem with ML style type inference is that it's fairly easy to make a type checker which works, but hard to make it return meaningful error messages.
@ccgarciab
@ccgarciab 11 ай бұрын
IMO keeping the inference boundary at the function declaration level keeps the error fairly contained and therefore easy to grasp.
@Danielo515
@Danielo515 11 ай бұрын
Absolutely. In practice you anotate the return values of functions or you will have weird type errors very far away from the actual problem source
@aoeu256
@aoeu256 11 ай бұрын
You can just turn off the type system and edit your program in the REPL with lots of tests that way you dynamic error messages like in Python & LISP which can be easier to understand at first until you understand the advanced type inference compiler algorithm.
@tourdesource
@tourdesource 11 ай бұрын
@@aoeu256 Interesting strategy. Is there a Rust REPL, though?
@taylorkim9191
@taylorkim9191 11 ай бұрын
im so glad i subscribed you, for "nipples" part lol and im also developer myself but i just enjoyed C++ and java are easiest to me
@AndrewErwin73
@AndrewErwin73 11 ай бұрын
As far as speed.. I DID make Rust faster than Go... don't get me wrong, Go is faster than shit! But here is the thing, Rust is actually faster in many cases; BUT!!! The compiler is not optimized for speed, it is optimized for safety. So, if you tell the Rust compiler that you prefer speed, it WILL deliver. I have done so many tests between the three (Rust, Go, C++) - from something simple like just iterating to 1 BILLION, to some more advanced stuff like prime sieves... with Rust, the trick is not optimizing the code, the trick is learning the compiler.
@SmplySilver
@SmplySilver 11 ай бұрын
rust binary sizes are absolutely not small compared to any other compiled language, given they statically link everything and don't do LTO to strip out unused functions by default
@afterschool2594
@afterschool2594 11 ай бұрын
C is like simplicity in process, Rust in the other way is simplicity in result
@thalissonvieira7008
@thalissonvieira7008 11 ай бұрын
tech events just broke me LOL
@baraa-almasri
@baraa-almasri 11 ай бұрын
lmao a star wars ad played before thr video, WITH DARTH VADER IN IT.
@KnightMirkoYo
@KnightMirkoYo 11 ай бұрын
Cstr is stuck, what can I do?
@tiagocerqueira9459
@tiagocerqueira9459 11 ай бұрын
If Rust it's not your first language, it might be confusing why some simple things can't be done in Rust. However, a new programmer doesn't know how it's usually done and the paradigm can click easier.
@d0rban
@d0rban 11 ай бұрын
At the moment, my biggest block on Rust at the moment is lifetimes.
@diadetediotedio6918
@diadetediotedio6918 11 ай бұрын
3:16 I think this has more to do with your coding practices. Even a C# program can be very ugly and hard to read depending on how you do it
@Julianacan
@Julianacan 11 ай бұрын
Love the energy, RAAA~
@seyofori
@seyofori 11 ай бұрын
Reminds me of Demeter's law
@yevgeniygrechka6431
@yevgeniygrechka6431 8 ай бұрын
One of the worst decisions that Rust made in its docs was to call references, "immutable" and "mutable", since these descriptors are basically false due to interior mutability. The correct descriptors are "shared" and "exclusive", but for some reason they are not used as much.
@dynfoxx
@dynfoxx 7 ай бұрын
I think shared and exclusive are better terms as well. Though immutable is not wrong. You cannot mutate through a non mut reference. You must always get a mutable reference before changing a memory address.
@wyatt8770
@wyatt8770 11 ай бұрын
Somone in the chat said "What about all the string types in C", and I'm trying to figure out what version of C has an actual string type
@atiedebee1020
@atiedebee1020 11 ай бұрын
I think they mean the difference between char[] and char*
@dynfoxx
@dynfoxx 11 ай бұрын
The Real difference between Rust strings and C strings is that Rust is explicit about what kind of string it is. Both have owned strings and non owning strings, C just doesn't mark them. They both have null terminated and sized strings. They both have different encoding ANSI, utf8 and more. OSstr is dependent on compile target for both languages Rust just encodes this in a type.
@monkev1199
@monkev1199 11 ай бұрын
wchar_16 and wchar_32?
@isodoubIet
@isodoubIet 11 ай бұрын
@@atiedebee1020 that's like the difference between 0.9999.... and 1
@atiedebee1020
@atiedebee1020 11 ай бұрын
@@isodoubIet absolutely not, when creating a string as char* s = "hello" this string will be put in read only memory, whereas char s[] = "hello" will be put on the stack
@codingtranquility
@codingtranquility 11 ай бұрын
The Book and Rustlings are fucking amazing together ... sure it'll only take you so far, but it's been a much better experience than any other language I've worked with.
@irlshrek
@irlshrek 11 ай бұрын
Couldn't agree more!
@Im_Ninooo
@Im_Ninooo 11 ай бұрын
please do more Zig content!
@TythosEternal
@TythosEternal 11 ай бұрын
"Rust is not for beginners" => eh? I do think it's a lot easier to understand the *why* of Rust's quirks if you've already shot yourself in the foot with C/C++ first
@bigtymer4862
@bigtymer4862 11 ай бұрын
Rust codebases are very involved no doubt
@SebastianSipos
@SebastianSipos 11 ай бұрын
18:00 happened more than once
@tuluwa
@tuluwa 11 ай бұрын
amazing thumbnail
@peterromfeld4091
@peterromfeld4091 9 ай бұрын
i never got over the compile time of rust, seems like 6 years later it still sucks... im more of a TDD guy, do tiny change and get immediate feedback
@sofiaknyazeva
@sofiaknyazeva 11 ай бұрын
That blog seems somewhat wrong on some points.
@chrisdaman4179
@chrisdaman4179 11 ай бұрын
Wasm is not taking over. It's so cumbersome to work with. And the binaries are NOT small
@PurpleLibRight
@PurpleLibRight 11 ай бұрын
Traits ,lifecycles & impls are a pain in the ass to read.
@irlshrek
@irlshrek 11 ай бұрын
If by "life cycles" you mean "lifetimes" then what I would say to that is that lifetimes aren't for humans to read. It's just for the compiler to understand what it needs to enforce rusts memory safety guarantees. When trying to understand what the code is intended to do you can almost always tune lifetimes out entirely.
@wesleyoliveira6570
@wesleyoliveira6570 11 ай бұрын
I don't agree with the blog poster's argument about not being for beginners, Rust is my first real programming language and I didn't find any of the memory concepts difficult to learn. What I found confusing is the structure of rust projects, as a few days ago I tried to make a project by compiling a binary and a dynamic library, it was a pain to know how to do this.
@rotteegher39
@rotteegher39 11 ай бұрын
2028 Linux Desktop 6:50 1 pack singular item. 14:54
@JackDespero
@JackDespero 11 ай бұрын
I think that Rust is hard for programmers because they need to unlearn C and then learn Rust. For beginners, I would say that Rust is easier than C. Not having to worry about pointers puts it already miles ahead of C. A normal person can easily understand borrowing intuitively: This is my book, I can lend it to y'all, but you are not allowed to write/highlight on it; or I gift you my book and you can do whatever you want with it. Super simple. People starting do not have the C structures and patterns ordering their heads, and thus they do not have a hard time trying to fit Rust, because they will find themselves in the situation of "I have been solving this problem with C in this way for decades, and goddamn Rust does not allow me to do it!", they will simply say "oh, it is super easy to solve with Rust in this way". It is hard to use a technology for decades and retain the degree of plasticity required to learn a new paradigm.
@lightprogrammer
@lightprogrammer 11 ай бұрын
It had a light side?
@cubbucca
@cubbucca 11 ай бұрын
Rust is the first language that even with a working example I have to read the book. dyn and impl make me pause to think every time.
@atiedebee1020
@atiedebee1020 11 ай бұрын
C pointers are like rust references, if pointers are hard to learn wouldnt rust references be hard to learn too?
@RenderingUser
@RenderingUser 11 ай бұрын
They are both medium difficulty to learn. But one is more confusing to use down the line the larger the project is.
@diadetediotedio6918
@diadetediotedio6918 11 ай бұрын
​@@RenderingUser Of course we are talking about the pointers
@RenderingUser
@RenderingUser 11 ай бұрын
@@diadetediotedio6918 ye
@irlshrek
@irlshrek 11 ай бұрын
I think the difficulty in pointers and C in general is in using them correctly. The whole giving you the freedom to shoot yourself in the foot kind of thing
@jboss1073
@jboss1073 11 ай бұрын
5:50 "it's not faster than C++" - Yes it is, the source is "Ranking Programming Languages by Energy Efficiency" which measures also time in a normalized way, and in that ranking Rust outperforms C++. In the most up-to-date measurements on the authors' website, Rust continues to outperform C++. So yes, Rust is faster than C++. However, C++ is the next fastest language, out of the 35 most popular as used by the paper. I have no dog in this fight, as I do not use either C++ nor Rust.
@NoX-512
@NoX-512 11 ай бұрын
Did the paper also rank Rust as faster than C? Because you can write C++ programs that is essentially C code. You can always write a C program that outperforms everything else except hand optimized assembly. Provided you have the skills, of course. The compiler and compiler options used are also important factors.
@jboss1073
@jboss1073 11 ай бұрын
@@NoX-512 The paper, when it was published, ranked Rust second place right behind C and ahead of C++ (top few languages in the Time measurement, in order and with multiplier for how-many-times-slower-than-C (rather, how many times slower than the first language, which happens to be C): C = 1.00, Rust = 1.04, C++ = 1.56, Ada = 1.85, Java = 1.89, Chapel = 2.14, Go = 2.83). However, the website has measurements that have been updated to 2021, I believe, from the 2017 date of publication of the paper. As it stands by those more recent measurements, Rust is now = 1.00, meaning it is just as fast as C. Indeed the Programming Language Shootout uses 10 algorithms to measure the speed difference between C and Rust, and each of those languages wins on 5 algorithms, making it a perfect tie for fastest language between C and Rust. C++ has not closed the gap (it kept being 1.56 times slower than C). Hence the old myth that "Because you can write C++ programs that is essentially C code" does not seem true. Also, a reminder that C++ is not a superset of C.
@NoX-512
@NoX-512 11 ай бұрын
@@jboss1073 I'll bet the C++ samples weren't written in C style, because that wouldn't make much sense in such benchmarks. Although C++ is no longer a superset of C, the features that C has that C++ doesn't, is not something you notice in day to day use. Take such benchmark with a huge grain of salt. The coding style and skill level can also have a big impact on performance.
@jboss1073
@jboss1073 11 ай бұрын
@@NoX-512 As of now it's (1) the most trusted website in measuring language performance and (2) the most recent and most quoted paper measuring language performance both agreeing that Rust is as fast as C ans that both are noticeably faster than C++. I do not advise too big a grain of salt.
@NoX-512
@NoX-512 11 ай бұрын
@@jboss1073 It's syntetic bencmarks. They often don't translate well to real life performance. I have no doubt that Rust is fast, but which language is fastest, will be different for different use cases, and heavily dependent on the compiler used, and the programming techniques applied. Writing C style code in C++ produces the same machine code as writing in pure C.
@sortof3337
@sortof3337 11 ай бұрын
simple does not equal easy. It is fking simple to see and say that you understand world, world is freaking simple. But its not easy thing to comprehend. I think programming is the same.
@ThePrimeTimeagen
@ThePrimeTimeagen 11 ай бұрын
Agreed
@fredoverflow
@fredoverflow 11 ай бұрын
Have you seen Rich Hickey's talk "Simple Made Easy"?
@sortof3337
@sortof3337 11 ай бұрын
​@@fredoverflow yes yes i have. Where'd you think I got my opinons? LOL I recommend how to scam american programmer. THat is a good talk as well.
@redhawk3385
@redhawk3385 11 ай бұрын
For me I just started only driving Linux, so it really is the year of the Linux desktop.
@danvilela
@danvilela 11 ай бұрын
Time to shave that one pack bruh
@Reydriel
@Reydriel 9 ай бұрын
It's really hard to take an article seriously when it would barely pass middle school standards for grammar lmao
@SimonBuchanNz
@SimonBuchanNz 11 ай бұрын
... does Primeogen not know that Rust has channels?
Reddit is Charging WHAT For Their API???
37:04
ThePrimeTime
Рет қаралды 98 М.
The LAST Rust Drama
27:26
ThePrimeTime
Рет қаралды 95 М.
I Need Your Help..
00:33
Stokes Twins
Рет қаралды 138 МЛН
[Vowel]물고기는 물에서 살아야 해🐟🤣Fish have to live in the water #funny
00:53
Маленькая и средняя фанта
00:56
Multi DO Smile Russian
Рет қаралды 5 МЛН
The Stockholm Syndrome of SQL | Prime Reacts
31:21
ThePrimeTime
Рет қаралды 120 М.
AI Discovers Faster Algorithms
19:30
ThePrimeTime
Рет қаралды 204 М.
RustConf 2023 - Rust Foundation: Demystified
27:08
Rust
Рет қаралды 1,4 М.
10 Reasons Not To Use Rust (The Whole Truth)
4:59
fasterthanlime
Рет қаралды 192 М.
The Darkside of Software Engineering
30:43
ThePrimeTime
Рет қаралды 161 М.
Rust Absolutely Positively Sucks
20:15
ThePrimeTime
Рет қаралды 239 М.
Clean Code : Horrible Performance | Full Interview
47:13
ThePrimeTime
Рет қаралды 201 М.
What Color Is Your Function | Prime Reacts
34:05
ThePrimeTime
Рет қаралды 102 М.
Zig is FASTER and SAFER than Rust | Prime Reacts
31:19
ThePrimeTime
Рет қаралды 184 М.
Can I Survive a DEATH ISLAND in Factorio? (200 Days)
12:40
ambiguousamphibian
Рет қаралды 130 М.
Samsung or iPhone
0:19
rishton vines😇
Рет қаралды 8 МЛН
Apple watch hidden camera
0:34
_vector_
Рет қаралды 51 МЛН
Топ-3 суперкрутых ПК из CompShop
1:00
CompShop Shorts
Рет қаралды 278 М.
A Comprehensive Guide to Using Zoyya Tools for Photo Editing
0:50
Kalem ile Apple Pen Nasıl Yapılır?😱
0:20
Safak Novruz
Рет қаралды 1,2 МЛН