Rust makes you feel like a GENIUS

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 พ.ย. 2024

ความคิดเห็น • 1.4K

  • @NoBoilerplate
    @NoBoilerplate  2 ปีที่แล้ว +89

    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"

    • @NoC4k3
      @NoC4k3 2 ปีที่แล้ว +6

      While we're at it: in line 4 you declare the 2.nd editor as molly, bit in line 7 it's dave. (6:26)

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +1

      @@NoC4k3 Thank you!

    • @henkoglobin
      @henkoglobin 2 ปีที่แล้ว +1

      @@NoBoilerplate At 7:09, the error says the value `vec` was moved, when the variable is actually called `users` in the code.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +4

      @@henkoglobin So it does! Thank you very much, I renamed `vec` to `users` to make it more understandable. My future videos are much better at catching this kind of error with compiled mardown source. Thank you!

    • @henkoglobin
      @henkoglobin 2 ปีที่แล้ว +2

      Oh and while we're at it... at 09:43, it says 'equivilant' instead of 'equivalent' :D
      Btw, very impressed with your videos! I only found them yesterday, but they're giving an amazing intro to Rust and I love every minute of it!

  • @theRealPermagreen
    @theRealPermagreen 2 ปีที่แล้ว +1723

    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.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +236

      I can't tell if you're complementing Rust or hate puzzle games!

    • @rallokkcaz
      @rallokkcaz 2 ปีที่แล้ว +73

      @@NoBoilerplate I think it's both but goddamn does it work!

    • @astral6749
      @astral6749 2 ปีที่แล้ว +17

      Remember not to include unintuitive behaviors.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +84

      @@rallokkcaz No puzzle game ever let me write Linux kernel modules, so there has to be more to it than that XD

    • @theRealPermagreen
      @theRealPermagreen 2 ปีที่แล้ว +43

      @@NoBoilerplate Admittedly, most puzzle games I know don't give you tools which are Turing complete and a lot of them devolve more into trying to figure out which specific solution the devs had in mind rather than using logic to reason things out, but I think my point still stands

  • @Yogii0000
    @Yogii0000 2 ปีที่แล้ว +1736

    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.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +345

      Ah yes! Thank you very much for the correction! What I should have said, is that even at runtime, rust's errors are better. For example:
      vec!("cat", "dog", "mouse")[6]
      > index out of bounds: the len is 3 but the index is 6

    • @harshmudhar96
      @harshmudhar96 2 ปีที่แล้ว +216

      Also.. It's totally a fair comparison on static analysis when one of the languages is javascript, lol.

    • @mr.mirror1213
      @mr.mirror1213 2 ปีที่แล้ว +16

      @@harshmudhar96 💀💀💀

    • @franciscomacedo5984
      @franciscomacedo5984 2 ปีที่แล้ว +193

      Ah evangelism indeed, the fantastic world of Software as a Religion (SaaR)

    • @harshmudhar96
      @harshmudhar96 2 ปีที่แล้ว +1

      @@PefectPiePlace2 ok ayaka.

  • @scheimong
    @scheimong 2 ปีที่แล้ว +181

    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.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +10

      Isn't it joyful!

    • @brunocabral88
      @brunocabral88 2 ปีที่แล้ว +15

      I guess you’re not testing your code enough (if at all) then. It’s nice to have the compiler warn us about the bad things that may happen, but it will never replace the good old testing..

    • @1SquidBoy
      @1SquidBoy 2 ปีที่แล้ว

      @FichDich InDemArsch you can do better than that

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +6

      @@1SquidBoy I blocked him, sorry for the trouble

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +27

      @@brunocabral88 Quite right: Testing is never going away, and is indeed very needed.
      In my experience, Rust lets you test what actually matters. The richer you type system, the more the compiler can prove your code, and the less low-level unit testing needs to happen, and you can focus on testing behaviour. It's such a relief!

  • @Hwyadylaw
    @Hwyadylaw 2 ปีที่แล้ว +37

    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.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +3

      All this, and it's popular, too! What a gift!

    • @raffimolero64
      @raffimolero64 2 ปีที่แล้ว +4

      the crab has to be the best language feature.
      oh you mean the crab is only a fan mascot?
      shut up. the crab is a feature.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +2

      @@raffimolero64 🦀

  • @BlunderMunchkin
    @BlunderMunchkin 2 ปีที่แล้ว +60

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

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +13

      Respect. Nothing wrong with being humble

    • @mostefajakboub2847
      @mostefajakboub2847 11 หลายเดือนก่อน +1

      your comment match perfectly with your profile picture

    • @maheshkanojiya4858
      @maheshkanojiya4858 หลายเดือนก่อน

      We are same bro

  • @n0xter95
    @n0xter95 2 ปีที่แล้ว +10

    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

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +2

      THIS is what it's all about. Thank you friend for commenting. I'm also a web developer, and I want to build websites in Rust!
      By the way, you can get all of this on the frontend because of native webassembly, check out yew.rs (boring website, excellent framework)

    • @n0xter95
      @n0xter95 2 ปีที่แล้ว +3

      @@NoBoilerplate Thanks! I wish you were my school professor with the way you explain, learning like this is a whole new experience! Also, the website is very pleasing and eye-catching. I like it. I will have a look at everything, but first I'll be sure to check out some Rust material to get the hang of it. Keep it up!

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +3

      @@n0xter95 You're too kind! My next video will be on the magic of macros and why you should want them

    • @clonkex
      @clonkex 2 ปีที่แล้ว +3

      If you don't already, use typescript. Once you get over the initial hurdles of getting it to compile and ensuring you have type definitions everywhere it makes JavaScript VASTLY more usable, fun, easy and reliable. I still prefer C# but TypeScript is a close second

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +1

      @@clonkex I agree with David here - Javascript is a necessary evil of our work as developers, and TS SIGNIFICANTLY tames it! However, for my next frontend project I'm going to be trying out Yew yew.rs !

  • @severinweigold9125
    @severinweigold9125 2 ปีที่แล้ว +113

    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.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +42

      Oh no! You're quite right, thank you for spotting this error. I will add it to the ERRATA section in the video description. I will compile my examples next time!

    • @boiimcfacto2364
      @boiimcfacto2364 2 ปีที่แล้ว +14

      @@NoBoilerplate I doubt a language can make you feel like a genius when the comments' section has to point out the error lol. JK, loved the video!

    • @jens6398
      @jens6398 2 ปีที่แล้ว +12

      "A language that stops you making mistakes" - Followed by a subtle mistake... Not exactly advertising Rust here.

    • @remrevo3944
      @remrevo3944 2 ปีที่แล้ว +16

      @@jens6398 Well, it would not compile, that's dramatically different then when it failed at runtime.

    • @mattshnoop
      @mattshnoop 2 ปีที่แล้ว +18

      @@jens6398 except when he makes this "subtle mistake", the compiler will give him a very pretty error message explaining exactly what's wrong… which was the point of the whole first five minutes of the video lol

  • @RyanRussonDev
    @RyanRussonDev 2 ปีที่แล้ว +69

    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.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +62

      This is a deliberate omission. You can find hundreds of videos comparing rust to C and friends. If you're coming from C, the benefits are obvious, and even more importantly, you understand them. Tell a python developer that they don't have to manage memory and they'll be all O.o

    • @shlokbhakta2893
      @shlokbhakta2893 ปีที่แล้ว +3

      @@NoBoilerplateO.o

  • @Hobbitstomper
    @Hobbitstomper 2 ปีที่แล้ว +19

    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.

    • @meamzcs
      @meamzcs 2 ปีที่แล้ว +2

      Since you can call into C code almost without losing any performance, a lot of bindings to C libraries exist.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +6

      While that is true, let's keep perspective. Crates.io has the same number of packages as NPM did in 2012. There's a lot to do, but I remember how much production JS I wrote in 2012 - I think there's certainly enough popularity to get cracking!
      In terms of documentation, I must strongly disagree, I find Rust crates' documentation to be the best I've ever seen. Perhaps the built-in documentation system encourages this behaviour?
      But in general, I agree with your statement:
      You CAN and SHOULD write production Rust in 2022, and there are plenty of core packages to support you: AWS sdk, windows sdk, world-class serialisation (such as json) and async.
      But while all of these exist, there will be more plumbing to do than with a more mature language ecosystem, so greater experience will be required.

  • @adileturaimov5952
    @adileturaimov5952 2 ปีที่แล้ว +313

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

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +46

      Thank you! I think of myself more as Mr Rogers "I'm not very good at drawing, but it doesn't matter"

    • @adileturaimov5952
      @adileturaimov5952 2 ปีที่แล้ว +5

      @@NoBoilerplate Ahah, exactly!

    • @Nishandh_Mayiladan
      @Nishandh_Mayiladan 2 ปีที่แล้ว +2

      LOL

  • @microcolonel
    @microcolonel 2 ปีที่แล้ว +5

    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.

  • @themichaelw
    @themichaelw 2 ปีที่แล้ว +3

    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.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      Yes indeed, I should have compared like-for-like.
      HOWEVER the runtime errors are still better than python's errors (rust tells you WHERE on the line the error happened)

  • @dorjegilfillan
    @dorjegilfillan 2 ปีที่แล้ว +8

    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.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +4

      That is SO good to hear, my entire motivation with these videos is to shine a light onto this incredible language that is just WAITING for us to change the world with!

  • @Tanimodoli
    @Tanimodoli 2 ปีที่แล้ว +4

    1:41 JavaScript's Array has variable length while Rust's Array has fixed length. If you want to use a "fixed length" Array in TypeScript, you must use Turple annotation or as const. The TS will report an out-of-index error at compile time as Rust does.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +1

      Quite right, my example was not apples to apples. I should have illustrated rust's good errors with a better one, apologies!

  • @elliott614
    @elliott614 2 ปีที่แล้ว +3

    I always wanted to chuck my computer off the balcony bc of that pesky borrow checker on my PL theory class projects (where we were doing things that were absolutely stupidly hard to do in Rust). But what's cool is almost every single time, once it compiled it worked perfectly

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +1

      This is exactly it! You will eventually get a feel for writing reasonably correct rust (at least, that's what I'm hoping for lol) and after this learning curve, you have a whole career of rock solid correct code to look forward to!

  • @stdprocedure
    @stdprocedure 2 ปีที่แล้ว +4

    I came from Java, and initially, I didn't like Rust too much. But, sometimes, I felt that my code was always missing something. For example, immutability, null checking, optimization, and even manual memory optimization. Rust is the best programming language, because it's the language that has less "stupidity", your code can do exactly what you want to do, without worrying if some random state can cause a different behavior in your program. Rust doesn't have nulls, Rust has memory safety, which is REALLY COOL, because understanding your memory, you understand the relationship between other data. Everything I wanted in Java, is in Rust. All my dreams about making the perfect code, are here. Rust makes you feel like a genius, because other program languages, makes you feel stupid.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +2

      You've captured my feelings too! This is why I started this video series!

  • @alejandrocelery3091
    @alejandrocelery3091 7 หลายเดือนก่อน

    Your video-making style is stellar. I don't know Rust, and all snippets I read made me think "geez, why did they do this or that with the syntax?". But after "rust for the impatient" and this one I'm really interested in learning more. Superb, kudos!

  • @ItzKernel
    @ItzKernel 2 ปีที่แล้ว +415

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

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +39

      That's it! Very satisfying 😁

    • @PCB389
      @PCB389 2 ปีที่แล้ว +15

      Bro I just made a Hello World example and feel like Linus 😎 After that I just want to finish my work and go do some Rust programming all day

    • @nexus4dev
      @nexus4dev 2 ปีที่แล้ว

      :/ Rust eventually will Die one day and no one will use it, but we have A LONG time before it will happen!

    • @ItzKernel
      @ItzKernel 2 ปีที่แล้ว +2

      well, everything will die eventually

    • @PCB389
      @PCB389 2 ปีที่แล้ว +7

      Is better to rust out than wear out.
      -Some old guy

  • @nderimtopalli3027
    @nderimtopalli3027 2 ปีที่แล้ว +3

    I am a Javascript developer. The borrow checker blew my mind. Never seen anything like this. Seems it is time to give a look at Rust. Thanks for the video. Subscribed.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      Always good to learn more languages, especially if they teach you something useful!
      Keep excited about the borrow checker, there's some tough new concepts for you to learn at the start, but it is WORTH IT. I started here, you should too doc.rust-lang.org/stable/book/

    • @spicynoodle7419
      @spicynoodle7419 2 ปีที่แล้ว

      Debugging JS (especially React) is terrible

  • @Haiderali-qd1jy
    @Haiderali-qd1jy 2 ปีที่แล้ว +20

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

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      Thank you! I hope you like it!

  • @aaronocelot
    @aaronocelot ปีที่แล้ว +1

    Great video: I sent it to some friends to propagandize them:
    one little note:
    *re this "cpu's don't know types, they only know ones and zeros" - mostly true, however see "stride size" on a typical DMA controllers.
    types are the bridge between ones-and-zeros and the real-world-modeling we superimpose upon them.
    it's the cookie-cutter shape of the data. We define struct types for the purpose of allocating discrete amounts and shapes of memory.
    It can also directly infer hardware execution paths, actual circuit switching: for example: If we look at an I2S stream going to an audio DAC, we can see the frame-clock toggling every two sample-boundaries (for a stereo audio track, multi-channel I2S being considered TDM already).
    The samples are real to the hardware, as are the frames.

    • @NoBoilerplate
      @NoBoilerplate  ปีที่แล้ว

      Interesting! Thank you for the explanation :-)

  • @thearyanahmed
    @thearyanahmed 2 ปีที่แล้ว +474

    Never thought I would watch rust video as bedtime story 😂
    Nice voice and storytelling sir!
    Btw, rust compiler sometimes seems like a mini AI.

    • @runtimejpp
      @runtimejpp 2 ปีที่แล้ว +2

      best idea thanks

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +35

      If you want me to ACTUALLY tell you a bedtime story, I produce a Hopepunk podcast called Lost Terminal narrated by a mini AI! th-cam.com/video/p3bDE9kszMc/w-d-xo.html

    • @hezuikn
      @hezuikn 2 ปีที่แล้ว +4

      @@NoBoilerplate i cant wait for season 2!!

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +5

      @@hezuikn I have great news! There's 8 seasons! I had unintentionally named them badly so they were difficult to find on youtube. I've fixed the playlist names, here's season 2 th-cam.com/video/xBOTvsnP9Ug/w-d-xo.html

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      @@runtimejpp Start here th-cam.com/video/p3bDE9kszMc/w-d-xo.html

  • @violetsweet1660
    @violetsweet1660 3 หลายเดือนก่อน

    I have just started learning Rust after Python, and despite the numerous errors that caused my first program (first not directly sourced from the Rust book, anyway) to not compile, it was extremely satisfying to be able to whittle them down one by one using only the compiler's error messages. They are so clear, and the suggestions are so useful. This really minimizes the amount of pain I suffer from being unfamiliar with the syntax because the compiler just...tells me what I should be doing instead. Also, cargo is just great, and makes me not have to worry about any sort of Python-style Package Dependency Nightmare. It tentatively feels like Rust is a language that prevents one from being lazy up front so as to save one from more annoying work in the long run.

  • @stef4oben88
    @stef4oben88 2 ปีที่แล้ว +3

    The very first time i tried rust long ago, I was very impressed with the error messages, since i've never seen such good error messages. Rust has a lot of really good and interesting ideas. I think the only big issue is that it can take quite a while to get used to it.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +2

      Totally agree, it's a STEEP learning curve (I mean, not compared to C or haskell) get back into it with this blog, if you've not seen it: fasterthanli.me/articles/a-half-hour-to-learn-rust

  • @bozhidaratanasov7800
    @bozhidaratanasov7800 ปีที่แล้ว +1

    Have watched the video before and I did agree. Right now, going deep into lifetimes and the different reference/pointer types, "Genius" is not exactly what I feel like.

    • @NoBoilerplate
      @NoBoilerplate  ปีที่แล้ว

      You'll get there my friend, watch a few of my other videos to remind yourself of why you're powering through this difficult learning curve! :-)

  • @OwO-.
    @OwO-. 2 ปีที่แล้ว +47

    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!

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +7

      GREAT point! I hadn't considered that. It's like an extension of how comfortable I would be accepting Rust PRs: I have very high confidence that if the code compiles, I only have to focus on the logic

    • @leo848
      @leo848 2 ปีที่แล้ว +1

      Copilot still generates faulty code that compiles in Rust. One example of this is ranges: it seems to not understand that a..b means exclusive and a..=b inclusive in any functional-style code.

  • @martinslns
    @martinslns 2 ปีที่แล้ว +2

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

  • @laundmo
    @laundmo 2 ปีที่แล้ว +3

    the rust compiler can also perform black magic. example: in the bevy game engine ECS you write systems by writing a function with queries as the argument types. you literally filter what you want to work on through just the type system. woaahhh.
    edit: to show, this is a bevy query for the player and moving the players position:
    fn move_player(mut query: Query){}
    this allows me to loop over all entities with a Player component and gives me a mutable reference to the transform component. its super neat.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      That's some clever macros working, I bet! Because Macros only run at compile time, they are SUPERCHARGED by having a rich type system. This is an advantage that Lisp macros never had.
      This is also how www.shuttle.rs works - it is able to examine your code and spins up infra based on what you are USING. Wild.

    • @terradoom8503
      @terradoom8503 2 ปีที่แล้ว

      @@NoBoilerplate in this case actually, Bevy doesn't use macros (at least not in your code, anyway), just clever application of Rust's traits to do some type magic on normal functions. Also, I'd personally say Lisp macros are much more powerful, at least if you consider Common Lisp's reader macros, albeit at the expense of hygiene and ease of use.

  • @zeenix147
    @zeenix147 2 ปีที่แล้ว +1

    Great video!! One small thing: the “users” variable doesn’t need to be declared mut, even if the “send” method it’s passed to, takes mut because we’re giving up its ownership to that method.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +1

      Good point! I really need to consult with either a rust expert or the compiler for the next video!

  • @darkchoclate
    @darkchoclate 2 ปีที่แล้ว +54

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

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +10

      Sure, but where, what index was out of range? As I said in the video.
      However Python's kind of a joke to me these days. Have you ever tried explaining virtualenvs to someone? They don't reply straight away and give you this LOOK O.o

    • @darkchoclate
      @darkchoclate 2 ปีที่แล้ว +17

      @@NoBoilerplate I totally get your point... That Rust is better in showing bugs... It tells you exactly where it is, and what to do... I dont hate it, nither do i care about it...
      I agree that c and c++ dont have any usefull error management, where rust is clearly better...
      JS is joke at this point, i dont get why it has not been replaced, perhaps because of it wide spread use...
      But python's error management, i think is sufficient, If you are a developer, You dont need to be told what to do, you are capable of that, you just need to know what's wrong and where is wrong, that python does...
      And rust and python, both have it's own use, python is built to be easy to explain, yet beautiful to write, where rust is built to be safe, yet provide deep level control, so there is no competition here...
      and talking about venv, i think you need to explain better to user... Explain like this... "We have this python interpreter with it's library, now when we make apps, we download many library. Most apps we make will have different dependency, so there is high chance we will run into conflict with one dependency with other. On the other hand if we have a huge amount of dependency, python interpreter will have hard time finding what to import. so instead we keep the original interpreter where it is, and make a copy of this interpreter in our project directory, and use the copy instead, to store our dependency. So every app let have their own dependency in its own copy of python so no conflict happens..."

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +6

      @@darkchoclate "and so we rewrite the PYTHONPATH because the interpreter assumes everything is installed globally, and it has no concept of a project". Don't get me STARTED on setup.py deployments. Poetry is the best of the bunch, imo, but it's wild behind the scenes.
      As to the magic of Rust errors. You have nothing to compare this with in Python, and I didn't show it very well in this video (more to come). The trick is that after you've built the valid states of your program in the rich type hierarchy (or borrowed the aws or windows crates to do the work for you) the errors become not just primitive "array length x" or "invalid character at line y", but can deeply understand your system, and you can get errors like "this function uses the billing address when it should be the logged-in user's home address" (obviously, not in so many words).
      Think of it like database relations - rules that can't be broken, but at high-level in your code. I'm going to do a video on this soon, so stay tuned for more!
      If you haven't yet written much Rust, this might be an alien concept to you, because python doesn't have a rich type system. Have you tried Haskell? I learned that to become a better python developer - it's got a rich type system like Rust (a bit better actually). The problem we all face, and I hope you don't think I'm talking down to you, is called The Blub Paradox www.paulgraham.com/avg.html

    • @TristramOaten
      @TristramOaten 2 ปีที่แล้ว

      @SomeName SomeOtherName OH GODS I'M GETTING PTSD

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +6

      @SomeName SomeOtherName Your life doesn't have to be this way, it's not a 'generic' problem: it's only a problem with old "global install assumed" package management tools. The current way we do things is to isolate applications from each other: Docker is a great way of doing that with the current apt/pip/gem/npm infrastructure, but you don't need it in modern languages like Rust, where the package manager (cargo) keeps this all isolated for you.
      Rust even has hardly any system requirements - you don't even need libpostgres/libpq because they have been rewritten in native Rust, and then high-level interfaces built upon!
      This is the topic of my next talk, I hope to explain it better than in a short comment.

  • @vaidphysics
    @vaidphysics ปีที่แล้ว +2

    This whole notion of "data ownership" and that a variable ceases to exist the moment you assign it to another variable is something completely new to me. And I've worked with C++, Python and several other languages for decades now. This is one reason I look to learning Rust - to discover these "design patterns" (if that's the right term) which I've never encountered in other languages.

    • @NoBoilerplate
      @NoBoilerplate  ปีที่แล้ว

      My background is also very similar to yours (without the C++), Rust's refusal to repeat the same mistakes as other languages makes it VERY interesting to me!
      My understanding is that this pattern is similar to RAII, in C, except it's enforced at the compiler level, so you don't have to trust that your contributors have snuck in memory mistakes.
      I have a short playlist for people wanting to get up to speed with learning Rust and it's exciting features, if you're interested: th-cam.com/video/oY0XwMOSzq4/w-d-xo.html

  • @leddoo
    @leddoo 2 ปีที่แล้ว +4

    look, i get it, everyone here is very excited about rust, and that’s amazing!
    but there are also some misleading and very wrong claims here:
    rust’s type system doesn’t help you write *correct* code. in fact it is *very* bad at that (like almost every other language too). rust does help you write type and memory safe code, and prevents unexpected errors. but you can’t express domain specific constraints, like index < len, this array is sorted, this id references a valid database row, this enum value can actually only be a subset of the variants, etc.
    i agree with the “author” that rust is the best language for “correct” code that is also popular. but this isn’t how it is portrayed in the videos.
    and the part that is plain wrong is pretty simple: safe rust is not enough for very high performance code. and abstractions are not zero cost either - from a mental overhead and performance perspective. the simplest example of lacking performance is inlining: small functions (like getters & setters) do not get reliability inlined without the inline always attribute. if you call such a getter millions of times per second, it will show up in your profile. (it has happened to me on multiple occasions.)
    and again, yes rust seems like the language with the best out-of-the-box performance for average code (that is also a popular language). but that’s not what’s claimed in the videos.
    the videos make it look like the perfect language, which i understand to not be the opinion of the “author”, but i do wonder why they don’t actually say what they think about the language.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      There's a lot to unpack here, I think one of us is very confused. Let me try to clear things up:
      - You absolutely can express domain specific constraints like you suggested, there are design-by-contract crates and invariant crates that make use of the powerful macro system.
      - Getters and Setters don't exist in the language, are you thinking of Java?
      - Rust's type system absolutely helps you write correct code, in fact, I did a whole video on this topic th-cam.com/video/IA4q0lzmyfM/w-d-xo.html
      @leddoo, what I am sure we can agree on is Rust itself isn't perfect. I never have claimed such. For me, what Rust has is the perfect combination of COMPRIMISES. Haskell is excellent, and I love it. But I can't get work writing it. Coq can prove my logic, but I then have to translate it into imperfect C.
      I live in the real world, and I have to get paid to write as perfect code as I possibly can. For that reason, I'm excited about Rust.

    • @leddoo
      @leddoo 2 ปีที่แล้ว

      @@NoBoilerplate
      - so you do know about Coq - great! now imagine those types in rust. equality and other predicate types. clearly, you could express many more invariants this way. in rust you can't really write: "this function takes two arguments, and one needs to be a multiple of the other." or even something as simple as "an integer that is a power of two" with compile time checking (and having 2 times that integer still be a power of two). rust has this type "NotNull", which is a non-zero pointer. with richer types, there would be absolutely no need for that to be a distinct type.
      - bro no, i'm not talking about java. if you want a struct field to be "public read, private write", you have to make it private and have a public fn with the same name. but the getters/setters were more of an example of "small function, where the call overhead (push/pop stack) is greater than the actual work performed", so you want the call to be inlined. and that isn't reliably done in rustc, unless you use #[inline(always)]
      - yes, rust's type system can help you. and it does so much more than any other practical language i know. and that is also why i'm somewhat excited about rust. but i have also used it for a while now and know its limits. and i can see what the next language inspired by rust can look like.

    • @leddoo
      @leddoo 2 ปีที่แล้ว

      @@NoBoilerplate some more practical things you can't do in rust are:
      - "safe" memory allocators. because they require "proof" that a specific allocation belongs to a specific allocator and hasn't been freed yet.
      - using string asset identifiers (eg in a game) and have a compile time check that all those strings actually refer to real assets. and ideally replace the strings by some numeric identifier. the closest thing would be to generate an enum using some external process. but that complicates your build.

    • @leddoo
      @leddoo 2 ปีที่แล้ว

      just had a look at the `contracts` crate. very cool indeed!
      adding a bunch of runtime checks is very different though from compile time proofs and compiler checked "logical reasoning".

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      ​@@leddoo You sound like you know what you're talking about! Thank you for this explanation. I believe much of what you want in Rust can be achieved today with the macro system, albeit not wholly at compile time (I can't find a good example, but something like crates.io/crates/contracts)
      The bottom line is that where Rust isn't perfect, you can write new language features using the macro system, so I don't look forward to the next language!

  • @davidwayne9982
    @davidwayne9982 2 ปีที่แล้ว +1

    YES- I'm EAGERLY awaiting System 76 FINISHED POP OS totally written in RUST... soon as it comes out-- I'm getting it.

  • @porky1118
    @porky1118 2 ปีที่แล้ว +15

    I like how rust turned a weakness into a strength.
    The main reason, why these error messages were added, was the complicated borrow checker, so they needed a way to make it more accessible.
    And once they had that system, they just used it for everything.
    At least that's how I think, it was.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +4

      Right! That's a great way of looking at it

  • @tedelkington2808
    @tedelkington2808 ปีที่แล้ว +1

    @noboilerplate hear hear on noting the fact that the machine doesn’t know what a type is and that it is just a logical construct for the humans. We should note this more often as a community

    • @NoBoilerplate
      @NoBoilerplate  ปีที่แล้ว

      But just like how 'language', 'books', or the concept of 'love' don't exist in the physical word, these things are useful to us and should be cherished!

  • @jacksonarnold27
    @jacksonarnold27 2 ปีที่แล้ว +6

    Just need to say that the example/analogy at 5:10 is so fantastic. It instantly stuck and made sense; totally helped me understand a concept that was still a little bit nebulous to me. Love these videos and they literally were the first thing that let me understand what Rust actually is and why people love it so much. Like I knew about the compiler being amazing but not much else. Literally refactoring one of my projects in Rust now

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      I'm so pleased! The code in the Library example is a bit wobbly, see the ERRATA pinned comment for some mistakes I made there - HOWEVER the idea of loaning a book as an immutable borrow is CORRECT. I'll probably re-visit it in a future video with better code!

  • @topcivilian
    @topcivilian 2 ปีที่แล้ว +2

    I am beginning my programming journey with Rust as my first language.
    After 'tutorial hell' and learning a bit of python, js, bash, etc.
    I discovered Rust and didn't turn back.
    Now I have a love/hate relationship with the compiler.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +1

      Fantastic! Rust is a great tool to learn, but learning Javascript (and all it's problems!) would be a great second language too, just to be practical.
      My typical rust session would be:
      PAIN PAIN PAIN PAIN PA-Oh it's perfect and I'm done.

    • @topcivilian
      @topcivilian 2 ปีที่แล้ว +1

      @@NoBoilerplate me: forget semi-colon
      compiler: "Your computer will now self-destruct in 5.. 4.. 3.. 2.. 1.."
      me: add semi-colon
      compiler: "Hello, world!"

  • @eboatwright_
    @eboatwright_ 2 ปีที่แล้ว +4

    "You have to sit there and think about what caused your error. Because JavaScript is _certainly_ not going to tell you"
    SO TRUE!

  • @FarazMazhar
    @FarazMazhar 2 ปีที่แล้ว +1

    I am a fairly experienced Python main Data Engineer. I got Rust videos suggested out of the blue. After watching a few videos, you know what, I am gonna give it a go.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +1

      That's my background too friend! You're going to have a great time doc.rust-lang.org/stable/book/

    • @FarazMazhar
      @FarazMazhar 2 ปีที่แล้ว +1

      @@NoBoilerplate Thanks for making these videos. I started a few days ago. :)

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +1

      @@FarazMazhar Fantastic! Do watch all my videos, there's so much GOOD stuff in Rust that lots of people don't talk about (macros are my fav)

  • @benjinguyen9965
    @benjinguyen9965 2 ปีที่แล้ว +5

    yes it does, but it also makes you question whether or not you were even good in the first place when you first start off. Took me a solid year of rust before I became comfortable working WITH the compiler rather than fighting it or blindly doing whatever to appease it. A year later, I am madly in love with it.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +1

      Benji, we had the SAME experience with Rust!
      I HATED it to start with, I kept tripping up on little things like the two string types etc. I BEGGED my mentor to let me learn Go, but he kept giving me good advice, and explaining why Rust was going to be worth it in the end.
      And now look at us!

    • @brentsteyn6671
      @brentsteyn6671 2 ปีที่แล้ว +2

      I don't think Rust is that hard anymore. It took me 1 month to understand all the basic and complicated stuff.
      This is not because I'm smart, there is know enough resources out there to make you competent in rust very fast.

    • @benjinguyen9965
      @benjinguyen9965 2 ปีที่แล้ว +3

      @@brentsteyn6671 if you're able to understand lifetimes, how and when you can and cannot elide lifetimes, core Rust memory model concepts like why cell doesn't implement the sync trait, etc.. all within a month, I'd say you're a cut above the rest.
      Understanding the concepts for me at face value was one thing, but ingraining it into my intuition took time. Rust is a fundamentally different programming language, and it was difficult for me personally because I didn't have a C/C++ background, nor did I have experience with functional programming, all of which contain concepts that Rust adopted: Memory model aka atomics and ordering, monads, iterators, immutability by default, etc..
      I come from Garbage collected language and only had experience with Go as it pertains to static types, so you can bet that picking up Rust took a lot of blood, sweat, and tears 😂

    • @0ptikGhost
      @0ptikGhost 2 ปีที่แล้ว +1

      Rust, like Haskell, forces you to unlearn lots of bad programming habits. That is why it feels like you are fighting the compiler. You got away with bad programming techniques and Rust demands you abandon them or go into unsafe land. When you no longer fight the conpiler you have learned better techniques that you wish were better supported in other languages. And I do mean supported as most of Rust can be done in other languages, they just don't have support for these things out of the box and/or historical language defaults do not require enforcement.

  • @himboslice_
    @himboslice_ 2 ปีที่แล้ว +1

    so many views in such a short time had me questioning whether or not these vids had botted views lol.
    great content, glad the algo picked it up :)

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      I can't believe it either, people love rust!

  • @tannamnguyen4423
    @tannamnguyen4423 2 ปีที่แล้ว +3

    Your voice is so beautiful, hope you can share more stories

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      Thank you so much, I Practice a lot! I've been producing a scifi podcast since 2020, I'd love to know what you think th-cam.com/video/p3bDE9kszMc/w-d-xo.html

  • @bourehimyoussef111
    @bourehimyoussef111 ปีที่แล้ว +2

    I never thought I would be on the verge of tears in front of a programming video.

    • @NoBoilerplate
      @NoBoilerplate  ปีที่แล้ว

      Imagine what you will be like if I TRIED to make you cry, as I do in my story, Lost Terminal! Would love to know what you think: th-cam.com/video/p3bDE9kszMc/w-d-xo.html

  • @VictorTaelin
    @VictorTaelin 2 ปีที่แล้ว +21

    I've been programming for almost 20 years at this point, in small, big companies, for hobby projects, daily. I've used more than a dozen languages, including Haskell, for years. Haskell is definitely better theoretically. In practice, Rust is by far the best programming experience I've ever had.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +6

      Really great to hear this from a pro, thank you Victor. I agree, I've been programming (primarily in Python) for 13 years, and I feel the same.
      If I could persuade the world to use Haskell, I would, I adore Haskell! But Rust feels like it snuck Haskell into the cool kids club in C's clothing!

    • @itellyouforfree7238
      @itellyouforfree7238 2 ปีที่แล้ว +1

      the one thing i miss from rust are higher ranked types. the one thing i miss most from haskell and rust is specialization (as in julia). i always feel i ought to prefer haskell above all others because it "feels right", but i'm too unproductive with it and cant control at all space/time execution performance. rust instead is just love at first sight

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      @@itellyouforfree7238 Yeah, Rust doesn't have everything, but it's got so much right that I'm just delighted we have it, and it's so popular! What is Julia's specialization, I'm not familiar?

    • @itellyouforfree7238
      @itellyouforfree7238 2 ปีที่แล้ว +2

      @@NoBoilerplate i love rust too, it's my favorite at them moment, except when doing scientific computing, in which case i use julia. specialization is the possibility to have a generic `impl Trait for Type` and then a more specific `impl Trait for Type` for instance. this is not possible right now because one cant have overlapping implementations. this opens the door to all sorts of possibilities, the primary being optimizations. this is how julia deals with the multitude of mathematical objects you encounter in scientific computing. for instance, in a linear algebra library you may want to multiply matrices which are dense, sparse, triangular, symmetric, etc.. specialization allows to refine the generic algorithm to be better suited for the specific case

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +1

      @@itellyouforfree7238 ah right! Thank you for that info, it sounds like something that could be fixed in the future without breaking backwards compatibility. Fingers crossed!

  • @danielkodoh4679
    @danielkodoh4679 2 ปีที่แล้ว +1

    Rust/typescript dev here. For the typescript example at 1:39 , there is a optional feature called noUnchekedArrayIndexing or something similar that prevents these kind of error from happening. It’s optional because the typescript community found it too verbose. But great video

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      Oh many thanks! Not very experienced with TS, or Rust for that matter!

  • @NiDeCo
    @NiDeCo 2 ปีที่แล้ว +50

    As a full-time Haskeller, everything in this video sounds like a no-brainer 🙃
    But I do appreciate Rust's popularity convincing more programmers to write code the smart way. 👍

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +31

      This exactly this.
      I spent a lot of time in 2020 trying to find what the most perfect real-world language is, and my top 3 were Rust, Go, and Haskell. Haskell would have won, but I can't hire for it.
      I'm so excited by Rust because it's like Haskell snuck into the cool kids party wearing C's jacket. (and then won every game using Lisp's macro magic)

    • @godofbiscuitssf
      @godofbiscuitssf 2 ปีที่แล้ว +2

      "the" smart way.

    • @NiDeCo
      @NiDeCo 2 ปีที่แล้ว +5

      @@NoBoilerplate That, and I guess Haskell's errors are still pretty bad (since there's been so little focus on them), so I understand why you'd put Rust above it.
      Though I have to say, I'm loving the acceleration that's happening in the Haskell ecosystem right now. We're getting more and more momentum in getting rid of legacy issues, more effort and money into getting everything up to standard, etc. So I'm really hyped for what's gonna happen in the coming years, and also hope Rust will keep steaming ahead ♥

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +7

      @@godofbiscuitssf Rich type system + functional programming is the right way. It's even snuck into javascript through React!

    • @godofbiscuitssf
      @godofbiscuitssf 2 ปีที่แล้ว +3

      @@NoBoilerplate Not for everyone, and certainly not for every context of programming.

  • @ankk98
    @ankk98 2 ปีที่แล้ว +2

    Impressed by the design of rust lang and the explanation of this guy.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      Thank you very much! Have you seen my first video, "Rust: Your code can be perfect"? More details there! I'm planning a whole series in the same style :-)

  • @CristianGarcia
    @CristianGarcia 2 ปีที่แล้ว +4

    Haven't seen the video but just wanted to say that *sometimes* the compiler makes you feel like a 5yo trying to build Starship. Anyway, love language, will check out the video soon!

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      Would love to know your thoughts

  • @friendlybear5924
    @friendlybear5924 2 ปีที่แล้ว +1

    Another very nice video. you also included some funny references and metaphores. I can't imagine how many hours you spent writing the script. Thank you for your great efforts to enrich our knowledge on Rust!

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      You're too kind! Check out fasterthanli.me for really great in-depth rust tutorials from someone who actually knows rust XD

  • @cocacodes
    @cocacodes 2 ปีที่แล้ว +19

    I am curious on how the Option and Result can be abstracted away. Wouldn't they have to store another byte to show if it None or Some?

    • @ericshimizukarbstein6885
      @ericshimizukarbstein6885 2 ปีที่แล้ว +15

      That depends on the concrete type of T, in general, yes, it has to store a extra byte, but for other types, like any reference to any type, the non null raw pointer types, the File type, and some others receive an compiler handled optimization where the None value is equivalent of a invalid value of those types.
      Option of References and non null raw pointer get optimized to NULL value on the None case. In the case of Option of File, the internal value of file_descriptor are set to -1 on UNIX (and on Windows an equivalent invalid value).
      Result cannot get the same amount of this kind of optimization because of the error type it needs to hold.

    • @cerulity32k
      @cerulity32k ปีที่แล้ว +1

      Yes, there is a discriminant byte. However, in the case of Option, a null reference is treated as None, because references cannot be null, so the discriminant byte isn't needed.

  • @cerulity32k
    @cerulity32k ปีที่แล้ว +1

    Every variable has one thing, and every thing has one variable. Such a simple rule extends so far.

  • @lxdzii
    @lxdzii 2 ปีที่แล้ว +7

    i am an undergrad student studying computer science, i have not reached this level of technical knowledge about languages, but your explanation of these high level concepts on programming languages made everything easy to understand! keep it up, also i haven't played much with rust, but what I'm getting from your enthusiasm for the language itself, is that its a really great language!!! i can't wait to play with it in the future ❤. you provide great video content too

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +2

      Thank you so much! Try starting here fasterthanli.me/articles/a-half-hour-to-learn-rust

    • @HelloThere-xs8ss
      @HelloThere-xs8ss 2 ปีที่แล้ว

      Of course you're an undergrad in CS. Yes, it's very common now

  • @abhishek.rathore
    @abhishek.rathore 2 ปีที่แล้ว +2

    Great video dude. Been learning Rust and I have been loving it since. Its awesome. Just like your content. Keep it up.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +1

      Thank you so much, I really appreciate your words!

  • @sobanya_228
    @sobanya_228 2 ปีที่แล้ว +6

    Kinda weird to chose that one error, that Rust also can't handle.
    And in rare situation, when the array is constant, Typescript also handles that (try 'as const')

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +2

      It's a bit of an odd choice, I suppose. I should have perhaps chosen a Vector for rust, as that's a runtime error. BUT my point that rust's errors are incredible would still stand!

  • @MrAbrazildo
    @MrAbrazildo ปีที่แล้ว +1

    2:37, I code that in C++, for runtime. It gives me the container name, its size and the index used, but don't give the command neither its line.

  • @udianilbey
    @udianilbey 2 ปีที่แล้ว +6

    Two very nice quotes from this video:
    "This solved the most difficult problem the hard way, not cheating with the garbage collector or leaving it up to the developer".
    "If you make a compiler that understands your program's memory exhaustively then you have made a compiler that understands your code exhaustively".

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +4

      Thank you! The first idea is very important. You can make memory easy, but then you lose out on the power!

  • @pilotashish
    @pilotashish 2 ปีที่แล้ว +1

    what a video. Enjoyed every second of it. The narration, to-the-point structure is so good. If only every video would be like this.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      Thank you! All of my videos will be like this! (Did you see my previous rust video?)

    • @pilotashish
      @pilotashish 2 ปีที่แล้ว +1

      @@NoBoilerplate yes really like your style. Subscribed

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      @@pilotashish I'm writing the next one now!

  • @moiattube
    @moiattube 2 ปีที่แล้ว +10

    I admit, when programming in Rust I don't feel like a genius most of the time. Compiler messages are wonderful, true, and the lang itsef looks modern and enjoyable to code but… BUT I feel like a dumb when I'm not sure what's going on with my var when I pass it to that function or return it from my own function! Should I copy, own, ref, WHAT?!
    I've been programming with memory managed langs for 25+ years. With Rust, sometimes I doubt if I really know programming at all
    So no genius feeling here but a being a humble learner at best
    That said, this video is an excellent presentation of Rust
    Thanks

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +2

      I'm a learner too, for all my excitement about rust, I'm still progressing slowly! I can answer your question however: copy everything while you learn. Not the most efficient, but it will work.

  • @EmilySillyDev
    @EmilySillyDev 2 ปีที่แล้ว +2

    This video has actually convinced me to try rust. It looks really nice to work in!

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      It really is! I learned from The Rust Book doc.rust-lang.org/stable/book/ and also Amos's blog: fasterthanli.me/articles/a-half-hour-to-learn-rust

  • @javidfarhan1675
    @javidfarhan1675 2 ปีที่แล้ว +9

    When I first discovered iterators in rust, I spent all day using them wherever I could. Its really fun to chain iterators together to get things done.
    Then I found out about lifetimes.

    • @zyansheep
      @zyansheep 2 ปีที่แล้ว +2

      rust really needs dependent types...

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      Rust's macro system can build this! One of the things that makes me very optimistic about rust is that it has a macro system. This means that we don't need to wait for dependent types to be standardised in the standard library, anyone can add them using the macro system!
      I see people are experimenting crates.io/search?page=1&per_page=10&q=dependent%20types

  • @ronensuperexplainer
    @ronensuperexplainer 2 ปีที่แล้ว +13

    As an expert of modern C++ threading, I must admit that in Rust it's always easier to write superior multithreaded code.

  • @Ariodan
    @Ariodan 2 ปีที่แล้ว +1

    less than two minutes into the video and I hear a sneaky homestarrunner reference. excellent video!

  • @andrewkovnat
    @andrewkovnat 2 ปีที่แล้ว +3

    WOW. I have been very interested in Rust recently, and tried it out for myself. I got rather frustrated when I was slapping pointers indiscriminately on variables, and recieved errors... but I simply didn't know how SIMPLE the memory management was in Rust! It makes too much sense, treating variables like objects that can't have multiple abstract sources and writers!
    Thank you so much for this wonderful clarification! Rust's whole system is ripe for visual gags too, like a drawing featuring an apple being shared and eaten amongst friends.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      Keep trying friend! I had to power through the steep learning curve, but it's WORTH IT (As I hope my videos can show) Try fasterthanli.me/articles/a-half-hour-to-learn-rust

  • @Nishandh_Mayiladan
    @Nishandh_Mayiladan 2 ปีที่แล้ว +1

    Thank-you for the comprehension !

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      My pleasure! Rust was very hard for me to get into, the learning curve is TOUGH, so I started writing these inspirational videos for people to get excited about this incredible language :-)

  • @WolfrostWasTaken
    @WolfrostWasTaken 2 ปีที่แล้ว +61

    Incredible video! Rust really seems like a language worth learning, and the community only seems to grow! I came in contact with Rust because I'm working on a Cosmos-based web3 project (smart contracts are all written in Rust), but now I kinda want to use it for my projects too! Do you think that Rust is mature enough to handle business complexity at scale while building a secure REST API?

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +10

      Absolutely my friend! Check out rocket.rs

    • @0ptikGhost
      @0ptikGhost 2 ปีที่แล้ว +7

      Word of caution, a secure REST API has more to do with protocols than the language used to implement it. Rust is mature enough to build scalable software. How secure that software is depends on many factors beyond what Rust can help wih. There is a reasonably large class of bugs that Rust helps you avoid as long as you stay on the correct side of the safety hatch. But software implemented in Rust can still have software vulnerabilities. Due diligence and proper security design/development is still important.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      @@0ptikGhost Why did you say this? Your comment could apply to any language.

    • @john_paul_r
      @john_paul_r 2 ปีที่แล้ว +2

      ​@@NoBoilerplate I think you two are on the same page. My read of Edwin Castro's comment is that they're simply stating that you need to take the appropriate considerations for security in Rust, as with any language (i.e. Rust does not magically whisk away all of your security woes). I think they're just tempering expectations.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      @@john_paul_r Yes, that I agree with

  • @kevingonzalez2120
    @kevingonzalez2120 2 ปีที่แล้ว

    clear explanations, soothing voice. PLEASE, keep creating stuff!

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +1

      Thank you! I will!
      I've practiced my 'radio voice' for quite some time, do you know about my scifi podcast, Lost Terminal? I wrote the videos in Rust! th-cam.com/video/p3bDE9kszMc/w-d-xo.html

  • @WilsontheWolf
    @WilsontheWolf 2 ปีที่แล้ว +9

    Honestly rust makes me feel like an idiot, due to the fact I have a hard time learning it

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +2

      It's so hard at the start isn't it! I started and stopped many times before I pushed through the initial phase! I promise it's worth it, friend. Re-watch my previous 'perfect' video on rust to get inspired!
      I found The Book to be a great way of learning doc.rust-lang.org/stable/book/

    • @Danielle_1234
      @Danielle_1234 2 ปีที่แล้ว +1

      "Everybody has a plan until they get punched in the mouth." --Mike Tyson
      Sparring with the compiler is a pain in the ass. There are so many concepts you have to learn to correctly code in Rust. It feels like you have to take multiple detours learning abstract concepts, but for each one you do learn the compiler becomes a friend.
      Don't fight with the compiler. Pause and instead of trying to solve your programming problem try to learn the programming concept deeply, then come back to your project.

  • @0.lennart
    @0.lennart 2 ปีที่แล้ว

    This is the perfekt summary. Just so satisfying to write rust. You know when it runs, it works.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +1

      Ah, I felt the same way about Haskell too! But Rust is something you can realistically get work in!

  • @derrick3534
    @derrick3534 2 ปีที่แล้ว +3

    Wouldn't it be nice if Morgan Freeman narrated borrower checkers?

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +1

      Morgan Freeman wishes he sounded like me ;-) /j

  • @Gareth1892000
    @Gareth1892000 2 ปีที่แล้ว +2

    Very nice explanation! However, one thing I always want these kind of videos to also include is the disadvantage of the language.

    • @sasas845
      @sasas845 2 ปีที่แล้ว +1

      Issues I know of:
      - limited interopability with C++, which is a problem since Rust & C++ use cases strongly overlap (hopefully we'll get something like SWIG for Rust soon)
      - No real support for shipping Rust code as shared library. This may or may not be a problem depending on the use case; personally (doing lots of "containers" and "apps") I've yet to encounter a situation where shared libraries would help. (Generic programming & shared libraries tend to mix badly together; AFAIK only Swift has a solution without extreme shortcomings for this problem).
      Overall, Rust is a very nice language to work with; and I blame a lot of that on the fact that Rust features some genuine technological breakthroughs (the compiler being able to precisely reason about the code to that depth is one breakthrough which will probably continue to create miracles)

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +1

      Very good points. There's plenty of pros and disadvantage videos of rust on yt.

  • @feitingschatten1
    @feitingschatten1 2 ปีที่แล้ว +6

    C++ developers learned long ago (then forgot lately) that the "rules" Rust uses need to be adhered to. Who owns memory, when does it release... ensure you name things so "open" and "begin" have "close" and "end". I see your OOP handling safety in Rust and I'm like "Hey! That was in Windows Game Programming by Andre" books.
    I yell at people who blame C++ when it sounds like they just can't keep rules straight in their head. It's only a few rules, basic OOP, used to be taught in the 90's. Lately nobody learns good habits. It sounds like Rust forces this ownership concept that used to be developer decided. Sometimes a bit of freedom and rule-breaking is appropriate (for games, tricks you wouldn't do at an enterprise). For example, the bit-flipping that people used to compress things by storing values in unused sections of a pointer. Obscure, dangerous... but needed on 8-bit gaming.

    • @magnusanderson6681
      @magnusanderson6681 2 ปีที่แล้ว +1

      Sure, but nowadays, we don't run software on 8-bit gaming machines and there's always `unsafe` if you really want it

    • @feitingschatten1
      @feitingschatten1 2 ปีที่แล้ว +1

      @@magnusanderson6681 It's not always unsafe if you have conventions in place to remember what you did, the same way a manual is safe to drive if you understand the clutch.

    • @magnusanderson6681
      @magnusanderson6681 2 ปีที่แล้ว

      @@feitingschatten1 Yeah its obviously possible to write `unsafe` rust code that is actually still safe.
      But its possible 99% of the time to right safe rust code that accomplishes the same thing, so I don't understand why you would think that not needing to constantly keep that headache (especially on codebases that are larger than any single person can really understand) would be a bad thing.
      Again, if you really want to, you can just put `unsafe` around all your rust code. But why would you, when painless safety is one of the main features of rust?

    • @feitingschatten1
      @feitingschatten1 2 ปีที่แล้ว +1

      @@magnusanderson6681 I wasn't referring to rust. I was referring to the idea that you shouldn't stick to one tool just because something forced you.
      Tools are tools. They're not opinionated. You don't quit drawing just because the iPhone can detect a silhouette.
      You don't forget calculus basics because the calculator can do it.
      You wouldn't throw your bike away when you buy a car.
      Likewise you wouldn't remove your tools to accomplish tasks in a computer just because of someone's opinion, or even a hard-to-find bug.
      What's appropriate for the task is always what's appropriate as a neutral idea. Rust doesn't like me wielding the heap on my own, that's fine, it works the same as retainCount in practice. I can work with that.
      But I can also throw global things on the heap and later handle it if I wanted, in C++... and sometimes I may want to do that, for ease of reading or maybe to avoid writing architecture. Maybe it's only 1 hack and the engine is otherwise fine. Much like graphics context, which is basically the OpenGL Ram environment. In that case, unmanaged heap matches a mental model of the physical structure. If I wanted to write "proper" variables for the context antipattern then I'd funnel it through a bunch of things that are honestly unnecessary.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      You folks obviously know a lot more about this than me. I will say that it's my understanding that you CAN do whatever you like in Rust if you scope it inside an `unsafe` block.
      You can write Linux kernel modules in Rust (the only other language other than C to be blessed to do so) From that I imagine that many tricks to handle badly-behaving hardware are needed!
      Check out the Rustonomicon for this doc.rust-lang.org/nomicon/
      And I will leave you with a counter to your first example, where you said as long as you know how to use the clutch, you can drive a manual car fine. The modern clutch is a very restricted, automated tool that strictly guides you into synchronizing correctly. Ask a trucker what they used to be like in the old days!

  • @the_real_briel
    @the_real_briel 2 ปีที่แล้ว +1

    Thank you so much for this juicy video! You deserve more views! You explained everything so succinctly without dumbing anything down. I was even able to show my girlfriend who is learning javascript this video on why javascript is whacky and she understood every word and every example! Not an easy feat! Thanks again, I hope to see more great videos like this in the future!

  • @SaHaRaSquad
    @SaHaRaSquad 2 ปีที่แล้ว +3

    Whenever I look at another language there's something disappointing about it in comparison. Usually compiler output & documentation, multithreading but also things like strings - Rust's handling of utf8 while still giving you access to every byte is great (I still wish there was a better way to get the char length though, this aspect is unnecessarily misleading).

    • @flyingsquirrel3271
      @flyingsquirrel3271 2 ปีที่แล้ว +9

      The "char length" is almost never what you want. Either you want bytes if you care about the amount of data or you want graphemes if you care about the amount of letters/symbols. Counting code points (the "char" primitive in rust) doesn't make much sense for most applications. Also: the fact that you have to write .chars().count() is the opposite of misleading. It makes it very clear that there is no way to obtain the number of code points without iterating over the string. Hiding a costly operatiom behind a .len() function would be more misleading imho.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +1

      This makes a whole lot of sense! Thank you!

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +1

      Yeah, I no longer get excited by new languages. I have started to wish people would write there new languages as rust macros! github.com/JunSuzukiJapan/macro-lisp

    • @SaHaRaSquad
      @SaHaRaSquad 2 ปีที่แล้ว

      ​@@flyingsquirrel3271 Yes, len() is consistent with the rest of the API, but in pretty much all other languages I'm aware of which bundle length information with strings it doesn't mean the number of bytes. In Rust this is rooted in an implementation detail.
      "you want graphemes if you care about the amount of letters/symbols"
      Great that the stdlib only provides char counting and no information about graphemes, then. So much for not being misleading.

  • @dealloc
    @dealloc 2 ปีที่แล้ว +1

    Just a tiny correction on TypeScript; with `noUncheckedIndexedAccess` it can infer the type as `T | undefined` to indicate that index access may return undefined, which is true if the array isn't a static array, marked as constant. Marking the static array as a constant (with `as const` type assertion) would throw a type error, even without the configuration. This is equivalent to using index accessor vs. `.get()` in Rust. No need for type annotations.
    As with anything it would be impossible to correctly type any external data that is unknown at compile time, unless you can confidently generate said types up front.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +1

      Thank you so much for the correction. I'm far from a rust expert, and even less a typescript expert!
      The key difference in this regard, compared to TS, is that rust libraries have no choice but to be richly annotated. Huge weight off my mind!

    • @dealloc
      @dealloc 2 ปีที่แล้ว +1

      @@NoBoilerplate The obvious limitation with static types on top of dynamic languages and runtimes, is that you cannot mix both worlds; e.g. use generics, unions or enums as data and vice versa, only as hints.
      I would love to have more Rust-y features (Result, Option, traits, etc.) in things like JavaScript without the overhead and awkward syntax that is needed to make it work there.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +1

      @@dealloc Rust is the compromise between Javascript and more esoteric ML-style languages like Haskell, I think. Rust has already compromised a lot from it's ML roots. If you want something that acts like haskell or Elixr but feels more familiar - Rust already has you covered.
      Have a look at Amos's blog, it's a great intro: fasterthanli.me/articles/a-half-hour-to-learn-rust

    • @dealloc
      @dealloc 2 ปีที่แล้ว

      @@NoBoilerplate Oh, I know Rust well! We are using it actively at where I work :-) What I meant was just that when I am in JS land, I miss the powerful syntax that Rust has for pattern matching, error handling and augmentation.

  • @KillerMZE
    @KillerMZE 2 ปีที่แล้ว +3

    Rust seems awesome, great video that clearly shows the advantages. However, there's no way I'm going to convert millions of lines of C++ code in my ongoing projects

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +2

      Don't have to my friend. Rust was designed to work with c++ so you can just write one module at a time. Don't replace what's not broke! The FFI system is zero-cost.

  • @reandov
    @reandov 2 ปีที่แล้ว +2

    Your videos are amazing! Keep it up with them, please! I'm beginner in Rust, making my firsts steps and everything is just amazing, mostly when you come from a unreliable programming language such as JavaScript.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      Fantastic! Keep going, it's not as simple as JS is it? But totally worth it! I used doc.rust-lang.org/stable/book/

  • @gioac96
    @gioac96 2 ปีที่แล้ว +6

    Ignore this comment, I’m just trying to show the algorithm that this channel is great by engaging with the content. Amazing video, keep it up!

  • @jmrumble
    @jmrumble 2 ปีที่แล้ว +1

    Ahhhhh the voice of Lost Terminal! I love it!

    • @jmrumble
      @jmrumble 2 ปีที่แล้ว +1

      It's dangerous to be alone. With Rust, you aren't. :)

    • @jmrumble
      @jmrumble 2 ปีที่แล้ว +1

      ... now I can listen to these (since discovering Lost Terminal) and imagine that friendly Seth is teaching me about friendly Rust :)

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      That's so fun! XD

  • @dudeguy7988
    @dudeguy7988 2 ปีที่แล้ว +5

    Rust makes me feel like a genius when I can actually understand what’s going on.

  • @rolandinnamorato1953
    @rolandinnamorato1953 2 ปีที่แล้ว +1

    Great presentation, great pace, great voice

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      Thank you! Do check out my other 3 rust videos and let me know what you think!

  • @voomastelka4346
    @voomastelka4346 2 ปีที่แล้ว +4

    You certainly have to be a genius to handle all the Rust's boilerplate for the data ownership. For instance, try your luck with cyclic references (e.g a tree where nodes have parent reference).

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +5

      My friend you're out of date! I believe you're talking about the challenge where A has a ref to B and B has a ref to A? How can the borrow checker clean that up? The simplest practical use of this pattern is a linked list, for which there is an implementation in the standard library doc.rust-lang.org/std/collections/struct.LinkedList.html
      How did they make this impossible structure? Using Rust's `unsafe` escape hatch: This is how you will find graph structures are built, the careful language and framework designers use this on tiny, heavily-audited, lines of the code to tell the compiler "I have checked this is valid behaviour, trust me".
      With rust, you can build safe interfaces on unsafe operations. In other languages, you must build entire unsafe PROGRAMS.
      If you ever have a data race, or memory overrun errors - you know EXACTLY where to look for these - inside the few lines of unsafe code.
      Have a look at doc.rust-lang.org/stable/book/ch19-01-unsafe-rust.html for more details

    • @johannes-vollmer
      @johannes-vollmer 2 ปีที่แล้ว +2

      With the ability to write macros in Rust, all boilerplate that could ever exist can be abstracted away

    • @voomastelka4346
      @voomastelka4346 2 ปีที่แล้ว

      ​@@NoBoilerplate I'm well aware that there are ways around that. I just want to point out, that Rust's *core safety feature* is too restrictive even for the fairly mundane data structures in its own standard library. If you look at the list of programming languages that don't have some sort of a built-in run-time automated memory management, then the only mainstream languages in it are C, C++ and Rust. The reason for this is very simple -- a garbage collector is a really useful thing to have and the only reason not to have one is when you can't have it for some technical reason (e.g. real time systems, tiny hardware etc). Otherwise it is always better to let the GC the memory management for you.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      ​@@voomastelka4346 The overwhelming majority of Rust code is safe code: In Rust, you can take the safety piecemeal. There are always areas where your code has to be unsafe, interacting with C code, or other native libraries, or even just interacting with The Real World! The genius of Rust is that you can build safe interfaces on unsafe code. You don't have to throw out the guarantees of Rust to do it.
      Example: If you want to interact with C code in Python, you write a C library with a Python interface. None of Python's guarentees (including the GC) apply to this C code you've had to write.
      In Rust, you write the smallest section of this using unsafe pointers you've TESTED REALLY REALLY WELL. And then build your safe Rust on top of it.
      I highly recommend checking out this doc.rust-lang.org/nomicon/meet-safe-and-unsafe.html

    • @Junior.Nascimento
      @Junior.Nascimento 2 ปีที่แล้ว

      @@NoBoilerplate so, i cant make a safe linked list in rust? i will have to "assume" that my code works and its safe?

  • @hrabianero
    @hrabianero 2 ปีที่แล้ว +2

    Elm has that really helpfull error messages too - it should be a standard in every language.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      Big fan. Have you tried Yew?

  • @duftcola
    @duftcola 2 ปีที่แล้ว +3

    Bias....makes rust sound more than what actually it is

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +1

      I know I have the tone of a salesman, but that's because I genuinely think we have something very new and exciting here!
      I'm personally excited to learn rust because with what other language can I write code for a tiny microcontroller with no space for a GC, a lightning-fast backend that is only 1.1x as slow as C, and even targed the browser in webassembly!
      There's really something magic here. Have you seen my previous video "Rust: Your code can be perfect"?

  • @mikicerise6250
    @mikicerise6250 2 ปีที่แล้ว +2

    I'm never going to like an interpreted language more than an elegant compiled language like Rust, but 'List index is out of bounds' seems clear enough to me too. 😉

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      which list index is out of bounds here, with that error?
      object[0][4][3]
      There's no reason for errors to be so obfuscated!

    • @mikicerise6250
      @mikicerise6250 2 ปีที่แล้ว +1

      @@NoBoilerplate In a list with three members? 😉 I mean, I agree with you, don't get me wrong. More precise compiler errors are welcome. I'm just saying, if that Python error seems unclear to you, allow me to introduce you to the hell that is C++ template coding. 👀

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +1

      @@mikicerise6250 In my example, it's a list within a list within a list - so "list index out of bounds" doesn't tell you WHICH index is the mistake. But I think we're on the same page.
      OH YEAH I'm going to feature the hell of template coding in the next video, where I talk about Rust macros, and how they change the game entirely (which of course, lisp peeps know already!)

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      @Unstable You're gonna love the next video!

  • @ShahJr
    @ShahJr 2 ปีที่แล้ว +5

    I've always preached about languages like Rust and Elm that embrace type theory but since using Clojure recently I've also come to love it for it's no bs and data as code philosophy. The lack of a type system here is could even be called a feature in this case. While the stacktraces are no where near above mentioned languages, it doesn't seem to be a issue most of the times as shown by the community's response.
    What do you think of this stark contrast between these languages and why do you think the claims made in this video seldom impact Clojure development? How did the lisp family get away with ignoring the holy type system? Maybe you could even do a video if you are so fascinated by this as I am.

    • @batlin
      @batlin 2 ปีที่แล้ว +1

      I'm fascinated by this topic too. I've enjoyed Haskell and Scala and a bit of Rust for a while, but I'm also swayed by Rich Hickey's assertions that problems of understanding the business domain, requirements etc are 10 or 100 times more time consuming than the errors a good type system helps you with.

    • @ShahJr
      @ShahJr 2 ปีที่แล้ว

      @@batlin Exactly, hopefully we see more discussions and more importantly, research and studies such topics as the programming community evolves.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +2

      Heh, if you have a glance at my upload history, you'll see that I actually used to love clojure, and did a video on it! I've also been a professional clojure dev for 2 years. Big fan.
      Rust has the best features of clojure and the best features of Haskell. From Clojure, it has the macro system, that treats data as code, and from haskell it has the powerful rich type system.
      All this in a package that has the C syntax that you seem to need for languages to be widely popular, and you've got something that isn't just technically good, but could actually become popular!

  • @haohao78
    @haohao78 2 ปีที่แล้ว +2

    Because of your last vid (and this one), I started learning rust. Been enjoying the experience so far (even though im still a very unexperienced programmer). Thank you so much for the video!

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +1

      Well done! It's really worth the initial studying, I promise! Check back now and then, I have new rust videos that I'm writing. Are you following the book? doc.rust-lang.org/stable/book/

    • @haohao78
      @haohao78 2 ปีที่แล้ว +1

      @@NoBoilerplate yeah, im following the book. English is not my first lang so sometimes I mixed some words up, but overall its not difficult to follow.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      @@haohao78 Let me know if I can help!

  • @cediwelli
    @cediwelli 2 ปีที่แล้ว +3

    Everytime I watch a Video about Rust, I am more convinced that Rust is a cult.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      Why's that?

    • @cediwelli
      @cediwelli 2 ปีที่แล้ว +1

      @@NoBoilerplate The way Rust-people talk about Rust and their subversive tone, trying to lure you into using the language. I get a similar feeling when watching C++ "Missionary" Videos but with Rust it feels more subconscious. I might give rust a try at some point in time but I feel tricked into a sect.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      @@cediwelli I understand that my videos are heavy on the sales pitch. I don't know how else to tell you that there's never been a language like Rust that is so popular that you might actually be able to use it professionally. I'm all-in, let's DO IT!
      A more down-to-earth person who loves rust is Amos over at fasterthanli.me/articles/a-half-hour-to-learn-rust

    • @cediwelli
      @cediwelli 2 ปีที่แล้ว +1

      @@NoBoilerplate Thanks, I'll check out Amos. Your Videos aren't bad, they are quite informative. It's just the feel I get and you don't have to change your style, espeially if I am the only one who gets this feeling. You are pretty friendly and because of that I'll sub, maybe at some point I will get used to your style. Have a nice day.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +1

      @@cediwelli Well thank you so much! I figure that we're all keen to learn, but youtube comments don't exactly foster a friendly atmosphere! Thank you for subscribing, I'll bear your comments in mind absolutely!

  • @saaddahmani1870
    @saaddahmani1870 2 ปีที่แล้ว +1

    So amazing, for these reasons I love Rust.

  • @atlantic_love
    @atlantic_love 2 ปีที่แล้ว +4

    Why would RUST make anyone feel like a genius? It doesn't do anything that C++ can't, and RUST's syntax is butt ugly.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      I know what you mean, Rust's got a lot of line noise doesn't it? I found that very tough to get past when I first started learning. It took me a while to realise that I was GETTING something from my investment in it: The compiler knows far more about your code than it could ever do without all the rich annotations.
      Regarding your second point, I'm afraid I can disprove that very easily:
      - C++ was rejected by the linux team as unsuitable for writing kernel modules with. Rust is about to be ratified, the only other language apart from C in their history.
      - Web programming in Rust is an absolute treat (backend with rocket.rs or webassembly frontend with yew.rs), you'll find few people wanting to code their apps in C++.
      - Rust solves safe memory management with the borrow checker. Once your C++ program becomes non-trivial, it appears to be impossible to avoid memory nightmares, which manifest as security holes so terrible that we give them names:
      Slammer worm, WannaCry, Trident exploit, HeartBleed, Stagefrieght, Ghost. The list goes on.
      Higher-level languages get memory safety by cheating with a Garbage Collector, but Rust keeps down at C's low-level by using perfect static analysis. It's really something!
      What sort of programming do you do, I presume you're a C++ coder? I'm learning so much about C accidentally while learning Rust, it's been really fun!

    • @atlantic_love
      @atlantic_love 2 ปีที่แล้ว +1

      @@NoBoilerplate Not by profession, I'm going through Stroustrup's newer C++ book, and I do know a fair bit of Python and JavaScript.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      @@atlantic_love oh snap! I'm a mostly python Web developer! Rust's benefits really rack up againt python: 80x faster, yet still being as high level as python. I find myself less satisfied with python these days, especially with indentation as blocks. Basically, as soon as I started doing a lot of yaml, I realised that braces are actually quite useful! XD

  • @johnforde7735
    @johnforde7735 2 ปีที่แล้ว +2

    I like Rust, it's my second favourite language. It has the best error messages that I have encountered. My favourite language is Swift, it is easier to understand memory and now it has the best concurrency support of any language IMHO. However, both languages would be improved if you could turn on ARC (Automatic Reference Counting) in Rust and if you could turn off ARC in Swift (and use some of the borrow checker stuff from Rust). I wrote an emulator in Swift, to see if I can write low-level performant code. It turned out OK, but a close to quarter of the time is spent reference counting. Hopefully we will get there.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      Great combination of languages there - swift for apple developement, rust for backend, frontend webassembly, and low-level microprocessors!
      Do you know about doc.rust-lang.org/std/sync/struct.Arc.html

  • @Diamonddrake
    @Diamonddrake 2 ปีที่แล้ว +3

    Have to disagree that “no errors” is inherently bad in the context you expressed. JavaScript not throwing an out of bounds error is just as much a feature as is anything else, using that one can shorten your code dramatically. It returns a falsey value which is very useful. It’s only an “error” to you because you decided it should be because it is in the languages you like. The idea that if it compiles it will probably work is a nice feature, but exchanging understanding for fighting your way to a compilation and assuming that means it’s right in this developers opinion is a trade-off not an objective improvement.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      I don't think this is a Good Part of javascript that you're defending.
      This pattern of returning some agreed-upon default instead of the type we expect (be it undefined, false, null, or -1) is something we're moving past as an industry. Typescript fixes this oversight, and forces you to deal with array[n] retuning an Option type, one that you must carefully interrogate for undefined before accessing.
      Even modern javascript has the `?` operator, which allows safe querying of deeply-nested objects, short circuiting on the first undefined. It seems even the language designers are improving the safety of this inherently bad pattern.

    • @Diamonddrake
      @Diamonddrake 2 ปีที่แล้ว +2

      @@NoBoilerplate I disagree, that shortcut operator only works because of that so called “bad pattern” and undefined IS the agreed upon None value you seem to desire. Undefined Is a runtime type and you can check it while your code is executing not just at compile time. CPUs don’t know about types, but objects do have types that running code not just compilers are aware of. It’s data stored into structures. You can check if a value is undefined using typeof, but If you’re going to check if an index is outside of bounds and then return None. That’s exactly what JavaScript does by default. Index out of bounds and you get undefined. A real type that can be checked for both literally and loosely. Yes you can have more confidence in your code if you satisfy the type checker, but often you’ll jump through hoops to make it happy when you didn’t need to. You will also get over confidence in your tools and start to dumb your way to compilation instead of really thinking through a solution.

  • @tsalVlog
    @tsalVlog 2 ปีที่แล้ว +2

    I've been using it for almost 2 years now, but YOUR explanation of the borrow system starting around 4:50 is the best I've found.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      That's impossible, I'm an idiot who doesn't know how to write Rust very well! But thank you!

  • @marusdod3685
    @marusdod3685 2 ปีที่แล้ว +3

    yeah it's safe until you use unsafe everywhere because the compiler won't stop nagging you

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      The unsafe block is explicitly not for turning off Rust's safety features. It's a little mis-named, honestly, and causes misunderstanding.
      Do watch my explanation here th-cam.com/video/PuMXWc0xrK0/w-d-xo.html

    • @marusdod3685
      @marusdod3685 2 ปีที่แล้ว +2

      @@NoBoilerplate I know it's not, but you'll end up using it anyways

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      @@marusdod3685 it doesn't turn them off. That's not how it works.

  • @jkone27
    @jkone27 ปีที่แล้ว +1

    So similar to F# , Option, Error. Beautiful languages 🎉

  • @OrbitalCookie
    @OrbitalCookie 2 ปีที่แล้ว +4

    I was evangelizing Rust to everyone, but they were all running away from me. It's hard being a genius.

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      If you've not heard of The Blub Paradox, your eyes will be opened to why it's so difficult to persuade people of high-level languages features www.paulgraham.com/avg.html

  • @MsKepher
    @MsKepher 2 ปีที่แล้ว +1

    Great video.
    Errata: slide 21 "IS EQUIVALENT TO"

  • @fifty6737
    @fifty6737 2 ปีที่แล้ว +1

    rust is the perfect choice of something i want to learn next

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +1

      Good on you! what's your background?

  • @humayunmir5563
    @humayunmir5563 2 ปีที่แล้ว +1

    great thanks for that! Very clear and articulate!

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว

      Thank you so much! I hope you like my other Rust videos, same style.

  • @user-cc8kb
    @user-cc8kb 2 ปีที่แล้ว +1

    You kinda sold me on it. I will learn some rust soon :) Thanks

    • @NoBoilerplate
      @NoBoilerplate  2 ปีที่แล้ว +1

      Excellent! The official book is a great place to start, it's where I did doc.rust-lang.org/stable/book/
      Let me know if you need help!