If you are interested in these topics, you can also follow me on Twitter :) twitter.com/terzi_federico
@richasha6703 жыл бұрын
One of the things that I love in rust is the most kindest compiler in the world! It’s like my mom when I was young
@FedericoTerzi3 жыл бұрын
I agree with you, the Rust compiler is one of the most helpful out there :)
@AfterDarknes3 жыл бұрын
Bryan Cantrill said, in a talk about writing operating systems in rust, the rust compiler treat you nicely so that you remember its kindness later when it finally show you its true color(when you get to write advanced stuff). They way he puts it was so funny, yet so true.
@ishdx93743 жыл бұрын
@@AfterDarknes I'm writing an OS in rust and everything has been quite nice tbf
@CEOofTheHood3 жыл бұрын
very original of you.
@anirudhsilverking57613 жыл бұрын
Meanwhile C++ hits you with an essay explaning why you're miserable for missing semicolon
@jesusmgw3 жыл бұрын
The rust compiler is so strict and clear in its output that learning the language is a matter of writing whatever pseudocode you think should work, let the compiler tell you what to change, change it, read the new compiler indications, making the changes, and so on until it compiles. And when it compiles, you are almost guaranteed that your program will work as expected.
@orkhepaj2 жыл бұрын
sounds good
@idkidk92042 жыл бұрын
Yeah, i just started messing around with it today and God it even explains what is wrong with the stuff you do
@atticus25812 жыл бұрын
@@idkidk9204 And why you thought it would work. I swear sometimes its questioning my intelligence. "why did you write that you idiot, heres why it doesnt work, its the same reason it doesnt work this this and this way. We've talked about this."
@costin65632 жыл бұрын
Pov: You are a Rust developer that hates C++
@jesusmgw2 жыл бұрын
@@costin6563 actually the g++ compiler is following rust's lead here and the messages are getting much better since rust devs gave the example.
@leealtair22963 жыл бұрын
As a not so experienced student,the segmentation fault and other memory related bugs in C/CPP are easy to pass compilation,but will eat you huge amount of time while debugging it.I would rather the compiler be more harsh,that's a worthwhile tradeoff~
@FedericoTerzi3 жыл бұрын
That's exactly what Rust does :) Coming from other languages the Rust compiler might seem very strict, but it's for good!
@katech60203 жыл бұрын
I agree, I lost many weeks trying to fix this kind of bugs
@ishdx93743 жыл бұрын
To be fair as you get more experienced, such things go away. But the problem is that segmentation fault isn't the scariest thing. The scariest thing is having vulnerabilities created by unsafe code. Also data races, but those are easier to mitigate
@diocre74463 жыл бұрын
@@ishdx9374 that is fine if you are working alone. But if you are in team that thing will be messy. Rust is efficient in this regard.
@ishdx93743 жыл бұрын
@@diocre7446 Indeed, but I found rust to be very frictionful when you write it
@AbhishekSingh-gk9gh3 жыл бұрын
I guess the only thing I would add is c++ has amazing external library support. As a Robotics developer I don't think I can get away without learning c++ but I am pretty sure I would be able to get away without learning rust. Unless rust offers major benefits and also adds community support (which is great in rust but still pales in comparison to c++) I don't think it will be able to outlive c++
@ahmadshiddiqn3 жыл бұрын
If the community is big and growing, it wont be that far long before rust becomes an alternative to c++ in robotics and of course embedded system in general
@IronJmo2 жыл бұрын
I appreciate how you said alternative instead of replacement. Very wise
@ProfAMuniz2 жыл бұрын
@@ahmadshiddiqn I have a soft spot for embedded system in my heart after messing with Arduino and Raspberry Pi. I'll be a programmer, but a programmer for embedded system nonetheless (so I'll mainly use C/C++). But I have Rust's book (2018 edition) here right now (came yesterday) and I'll have a challenging blast with it.
@Navhkrin2 жыл бұрын
Libraries get outdated over time though. And C++ is becoming a bigger mess every day because of their insistence on backwards compatibility. Not to mention you can connect some of the popular CPP libaries to Rust.
@gianni507252 жыл бұрын
Honestly rust’s big claim to fame so far has just been being soooo much better to work with than C++. From the compiler error messages to lack of undefined behavior (unless you use unsafe of course), to the strong types to better iterators… I think it will stay for a while just because it feels nice to program in. Also why there’s a lot of crates despite Rust being relatively new and only nacently used in real industry. But yes, C++ will stay around for much longer. Unfortunately. Despite what Cpp simps will tell you, it is neither well-designed nor nice to work in, even with the improvements made in the last 5-8 years. Because you just know below that nice modern layer is a huge layer of cruft… and if you work on anything low-level, guess which layer you’re stuck with?
@TheSulross3 жыл бұрын
C++ has a lot of strengths in its libraries - especially in things like parallel programming or GPU programming (e.g., Nividia has support for C++ memory model); however, relative to C++, Rust has a super power - its not weighed down by a many decades of legacy code and complexity creep, so in the long run Rust is going to triumph over C++
@EidosGaming3 жыл бұрын
That, and rust learned from the good and bad of its ancestors. It feels like it took all the good from JS, Haskell, C++... and didn't bother with features like try/catch or inheritance which 90% of the time comes from (or leads) to bad design. The language feels very rich while being as simple as it gets for a system language. I agree C++ has a very rich ecosystem, however its lack of globally accepted package manager and build system was the trigger for me to switch to Rust. It's an absolute nightmare when every library uses cmake, or premake, or meson, or gn... Plus crates.io is getting really populated :)
@Artaxerxes.3 жыл бұрын
@@EidosGaming Wow this comment sounds like a paid review
@EidosGaming3 жыл бұрын
@@Artaxerxes. lmao but I really believe it xD
@gavintantleff3 жыл бұрын
To be fair, C++ has stuck around for a long time, and I doubt it’s going away any time soon.
@yuverris3 жыл бұрын
yeah C++ proposing library solutions over language based solutions made it so hard and kind of bloated + keeping the backward compatibility which is a hard task on the committe making it in a position where it's really hard to advance any further
@LyubomyrSemkiv2 жыл бұрын
What is funny that all C++ criticism comes from people who don't know C++ at professional level and don't even understand what is it used for, where all their engines, browsers, computer graphics tools, audio tools, navigation systems, games come from. They tend to call this legacy but that is essential software, and new versions of it also written in C++. Rust's borrow checker is great tool, we want it in C++ and it may have future, but for now it cannot compete. C++ is modern, sharp high level language with optimizing compiler which exists literally for every CPU and platform on the market, it is really hard to beat.
@hallo-welt2 жыл бұрын
Totally agree.
@DBGabriele Жыл бұрын
and as you can see, 99% of Rust evangelists are web developers.
3 жыл бұрын
Good comparison. I think newbies should also know that unsafe shouldn't be generally uses to bypass the compiler but rather extend the language with new abstractions with *safe* API. In those cases a reviewer only needs to check those abstractions and know the rest is correct regarding memory safety.
@CallousCoder2 жыл бұрын
Define better... C++ is so much easier and more flexible (unless you use unsafe Rust) and even still faster and the ecosystems are more (far more) mature. Rust adds a nice assistance in memory management.
@cyrilanisimov2 жыл бұрын
I think good checker in C++ (like Clang tools or PVS Studio) provides not worse assistance
@CallousCoder2 жыл бұрын
@@cyrilanisimov clang with warnings enabled is indeed magical!
@fnizzelwhoop3 жыл бұрын
Overall this is a really good video, but I have one remark: Saying that unsafe rust "gets rid of all those safety guarantees" is a little bit misleading -- it's what has led people to think that if you put code in unsafe { } it switches off the borrow-checker, which isn't the case. Try taking two mutable references to an object. The borrow-checker will tell you this isn't allowed. Then put that code in an unsafe block -- you'll still get the exact same error. It's better to say that unsafe allows you to circumvent the borrow checker rules by allowing you to dereference raw pointer. (You can take raw pointers outside of unsafe rust, you just can't dereference them). I.e one shouldn't think of unsafe as switching a language feature off (the borrow checker), but rather it switches one on (dereferencing raw pointers).
@FedericoTerzi3 жыл бұрын
Very good point! Thanks for sharing :)
@ishdx93743 жыл бұрын
there are some other unsafe code can do, first of all, it can call unsafe functions (which don't necessarily have to do pointer dereferencing, calling other unsafe functions or use assembly), also you can't use assembly outside of unsafe code
@fnizzelwhoop3 жыл бұрын
@@ishdx9374 Sure, and access union fields. But when talking about the borrow-checker, I think dereferencing raw pointers is a better example. Oh, I see what you're saying! Yes, in the context of unsafe - generally speaking - one should mention the other things it unlocks as well -- I definitely agree.
@gianni507252 жыл бұрын
Yeah, the people who say “but it just becomes as unsafe as C if you use ‘unsafe’, so rust isnt safe” clearly dont know what theyre talking about. Compared to C where raw pointer references are king and overall just required to do anything at all, its incredibly sparse in Rust and overall discouraged unless its really necessary for speed or for functionality.
@Beryesa.3 жыл бұрын
I really like the community efforts in rust, specifically the rust documentation and that all rust projects generally take these things consider. I really like that :P
@zyansheep3 жыл бұрын
The rust doc system is absolutely phenomenal. Locally generated and it looks nice!
@ProfAMuniz2 жыл бұрын
Sadly, I don't have Rustup for accessing the documentation easily. I install Rust from Fedora repository and this Rust don't come with rustup. :(
@nathanjokeley41022 жыл бұрын
rust documentation is really bad though
@DaDa-gr7cy3 жыл бұрын
I was thinking that this is another classic comparison video from youtube before watching it, but this was really awesome good points and fair comparison, thanks
@FedericoTerzi3 жыл бұрын
Thanks! :)
@dzarko553 жыл бұрын
One big pro with rust for me is that you learn what safe code looks like, in many cases. Just an instinct that says "this seems wrong", because whenever you've tried it in Rust it complained and told you why. I've written safer* code in my other language (f90) since learning rust. * by safer, I mean avoiding memory issues, segfaults and the like.
@LoblueHaze3 жыл бұрын
I really like Rust. The language is very well documented and the compiler tells you the errors in great details. The only thing I don't like about Rust is that you need C++ build tool to use Rust, which makes me feel like Rust is still in beta or something.
@xrafter3 жыл бұрын
Well the c++ build tool include some important parts for any programing language like c and cpp which is the linker .
@hacktor_923 жыл бұрын
rust compiler is a frontend for llvm, and requiring c++ build tools means that you can ffi into your c / c++ lib to make it available in rust land. take openssl as an example. openssl crate is what you use in rust side, openssl-sys crate binds libopenssl in rust land and it instructs cargo in the specialized build.rs file to (maybe compile and) link libopenssl into final lib / bin.
@timerertim2 жыл бұрын
On linux, gcc is already installed on basically every distribution so no need to worry about it. On windows, I don't think it's a problem that you need C++ build tools since the compilation chain of rust depends on it. What I think is a problem (but that's not rust's fault) is that you need to install whole Visual Studio to get them. Which means, you need to install multiple GB of software in order to get the build tools which should be some MB in size.
@esjay35626 ай бұрын
C++/20 and later allows writing very safe code. Performance is excellent. A huge benefit of C++ is: - compile time evaluation (constexpr and constinit) - template programming (even with traits/concepts) is outstanding - great and mature optimizations by the compiler Also: - there are very fast and mature GUI packages for C++ (in Rust, most seem alpha to beta state) - in many cases, way smaller exe size
@AlessandroBottoni Жыл бұрын
Excellent video, kudos! It's a real pleasure to see an italian programmer recording such a nice video, on such an interesting topic, using the english language in such a good way. Congratulation! I'm going to watch your video tutorial playlist regarding Rust, as well. I'm sure it will be very engaging.
@FedericoTerzi Жыл бұрын
Grazie! :)
@Mal-nf2sp3 жыл бұрын
The biggest asset of a language is probably its community, resources, and libraries. C++ is better in this regard for now but hopefully, it will get better.
@FedericoTerzi3 жыл бұрын
Yes, exactly! I expect Rust to catch up in the upcoming years though
@jearlblah51693 жыл бұрын
@@FedericoTerzi it probably will as it has been the most loved (or close to it) for a while
@FedericoTerzi3 жыл бұрын
Yep, absolutely... Also considering that the big corportations are starting to invest on it
@vectoralphaSec2 жыл бұрын
@@FedericoTerzi Do you really think its possible for Rust, a 12 year old language to catch up to or even exceed a 37 year old language C++?
@vuanh40843 жыл бұрын
Love this video. I'm a newbie to rust and have learned so much after watching your video. Thank you so much
@culturedgator3 жыл бұрын
This channel deserves millions of views! Thank you for the quality content ^_^
@vectoralphaSec2 жыл бұрын
I dont care about systems programming. All i care about is Computer Graphics and Rendering. So all i want to know is if Rust can also be considered the future of those fields as C++ dominates them right now. If not then ill stick to C++ as the better/ superior option for Graphics programming.
@mannerinnen12562 жыл бұрын
C++ will never be replaced. Its just not possible.
@tofaa36683 жыл бұрын
People say rust is lacking in libraries however as a game developer whos been with rust since the start the community went from nothing to "I have always found a library that does what I want and never have a seen an empty search". Rust seems to be the future and I really hope that's the case, the language is fascinating
@vectoralphaSec2 жыл бұрын
I know that for Game Development specially in the AAA games scene C++ is the main only option. So do you think Rust will ever be just as good or maybe one day surpass C++ for games development or graphics programming? Personally i dont think so, C++ is too entrenched, but i could be wrong.
@Dirtboy372 жыл бұрын
@@vectoralphaSec I could see studios making their in house engine using rust eventually. Though one of the biggest reasons c++ is used so much in the games industry is because of Unreal Engine, and I don't think Unreal Engine is changing languages anytime soon but idk
@AllHailLordMegatron Жыл бұрын
Is there a game engine that uses Rust as its language ?
@bragefuglseth3505 Жыл бұрын
@@AllHailLordMegatron bevy!
@youarethecssformyhtml Жыл бұрын
@@AllHailLordMegatronGodot
@jongxina35953 жыл бұрын
Even if you dont like Rust, Rust helps you be a better C++ developer. The mentality of borrowing and ownership, avoiding raw pointers, const by default and only const references, etc. So many C++ developers dont do this stuff properly and even for those who do, the few slip ups are the major cause of bugs in the vast majority of the time.
@amoshnin3 жыл бұрын
Great explanation!
@FedericoTerzi3 жыл бұрын
Thanks! :)
@jgcodes20203 жыл бұрын
c++ is gradually improving: we got modules, coroutines, and template constraints just recently. I hear about rust and one reason I'm not exactly wanting to try it is because of its weird OOP system.
@jongxina35953 жыл бұрын
Even if you dont use it, Rust forces you to program the same way you are supposed to code in C++. Rust makes you better in C++. No need for pointers when you have references, no shared heap ownership, const by default, move semantics by default, etc. Some devs may be experienced and pretty good at memory management 101, but even the few slip ups are 90% of bugs.
@jongxina35953 жыл бұрын
@Joe Geezer 1. Not german 2. Only time can tell whether or not C++ will finally be replaced by the better language (Rust).
@jongxina35953 жыл бұрын
@Joe Geezer ok? My comment was about how good a language is. Rust came out about 5 years ago and C++ has about 3 decades. PHP was the defacto language for web applications. Now? It is dying if not dead already. Jusy because a language is popular doesnt mean it will stay, it certainly didnt mean that for php.
@jonaskorva24043 жыл бұрын
@@jongxina3595 Php is not dead. How can a language be dead when it powers most of the internet? Will most companies pick php right now if they were to build a site? Probably not. Will you find jobs around php? Of course you will. Most websites are built on top of it and most of the companies won't just change their whole codebase.
@nullpointer17552 жыл бұрын
Rust doesn't have OOP, it uses a much better system called Traits. Structs are the container for the data, and Traits implements methods (the logic) to perform on the data, which makes your code much more organized, because you are gonna separate the data from the logic. Traits allows you to define shared behavior between types. Because of that, Rust doesn't have the downsides of OOP.
@deniszaika95342 жыл бұрын
I'm trying to install rust, but it requires visual c++ compiler. This video should be titled eggs vs chicken.
@xr.spedtech2 жыл бұрын
4:13/4:14 Linux operating systems (especially arch Linux) pre-installs c/c++ libraries for you whenever you install them. It installs the compilers for you and if you aren't satisfied... You use the pacman tool to install anything; from software to dev libraries .
@silversurfer80573 жыл бұрын
hey Federico, is it possible to get more content about DeepSpeech? it would be very interesiting to see how to add new words and stuff like that. I like your getting started tutorial to this topic =)
@FedericoTerzi3 жыл бұрын
Thank you for the feedback! I'll think about that :)
@stolz_ar Жыл бұрын
I worked as a front end developer for almost 10 years and moved away from the industry about 4 years ago after a couple of bad experiences. Anytime I get that itch to come back and search for info on something new (like Rust) or any other content about software development, I only find boring, cringey or very subjective content or just unlikeable (even arrogant at times) people, like the ones that made me move away from programming. It's nice to finally see a good video with a 100% objective perspective and an excellent and very complete analysis of the subject.
@alphabasic1759 Жыл бұрын
Managing memory in C is NOT hard. Just learn what you’re doing.
@vedantmatanhelia10163 жыл бұрын
Rust sure has a lot of good features but what about the fact the when you want to write code in which u want to manage the memory yourself like some firmware or something
@FedericoTerzi3 жыл бұрын
You can do that in Rust as well :) But then you enter into the "unsafe" side of things, which gives you fewer guarantees
@vedantmatanhelia10163 жыл бұрын
@@FedericoTerzi From what i saw when trying rust is that it just complicates simple things such as mutability and slicing
@otmanm40953 жыл бұрын
I personally like a lot c++! Rust is cool but I don't know much apart the basic. Cargo is awesooooome
@marco212743 жыл бұрын
Go back 25 years and exchange Rust with Java. They all want to fix resource management but that is not the main problem in my experiences. It's cornercase handling which you cannot handle at compile time because it is hard to describe in syntax. You need tests for that and after I looked at the test support in the language my conclusion was that Rust will find it's niche like Go etc.. But it will not probably take over. Software developing is still dominated by the hacker image who is a genius and writes perfect code with vi 😉. It is a little bit like development of the first steam engines before engineering took over. And automated resource management has drawbacks too. If you do not understand anymore what is going on you easily will write quite slow and resource hungry code. Shared pointer are a good sign for that. If people using them they don't want to think about it. 😉
@aldeywahyuputra57193 жыл бұрын
It’s funny that you tried to compare Rust with Java, since both language are *fundamentally* different in which Java is a *managed* language with automatic *runtime* memory management / garbage collectors, while Rust is an *unmanaged* language like C/C++ that *does not* have *any* of it whatsoever.
@marco212743 жыл бұрын
@@aldeywahyuputra5719 The point I wanted to make was not how they want to manage resources management but that they think that resource management is the main problem. My personal experience is that TDD is not only fixing other bugs but resource management too. You really have to think about your resources but many think resources should be hidden away. My argument is that is okay for not so complex programs but if you reach some complexity resource management is not your biggest problem. It is the complex interaction between code. In my experience they easiest way is to express that into tests so the tests will do the heavy lifting if you change your code.
@aldeywahyuputra57193 жыл бұрын
@@marco21274 Let me comment on some points that you've raised there, > they think that resource management is the main problem I personally haven't heard that it's the main problem of programming, only that it's one of several problems that faced by software developers. *However*, it's one of the biggest issues that come to systems programming, which is one that have a high risk rate (Microsoft reports that 70% of their security issues are caused by memory bugs like dangling pointers, use after free, etc) and one that Rust is trying to tackle *without* the use of any Garbage-Collection techniques. > You really have to think about your resources but many think resources should be hidden away. That's true for a Garbage-Collected language, which *Rust is not*. Why? Because the opposite happens on Rust: you *really* have to think about your resources -- *not only* on managing it, but also whether your line of thought is correct or not, else you *are* going to fight with the borrow checker. -------------------------- I commented on your comment before because I wanted to clarify your comparison of two *fundamentally* unrelated things as your example (a GC'ed language vs an unmanaged one), *not* your arguments on what should be the main problems in programming. I agree that there's a ton of problems in programming and memory management is just one of them, however brushing off Rust as a 'new and shiny' Java is unfair and discredit a ton of effort to both languages.
@marco212743 жыл бұрын
@@aldeywahyuputra5719 Actually I don't wanted to say that Rust and Java are technical similar but both want to tackle the same problem: resource management. Resources like memory, files, handles etc. can be managed by lifetime management too. And you can add that to C++ too. You still have other strange historical artefacts but are they bad enough for breaking completely the code foundation? C++ was so successful because it was not breaking this chain. Not because it was the best language available. I cannot imagine that all this code will be reimplemented in Rust. You need that lifetime management for them too. So you need extra tools. You need tool that warns the developer as he typing code and not as he running the compiler. With a good IDE I run the compiler much less because I already get much more feedback much earlier. I do not care so much about the language but I am getting too old to buy this silver bullet story. I see a big problem because there is now the Rust camp which wants to change 'everything' and the old guard C++ camp which does only wants painless change. I argue for something in the middle. Something more integrated. Something less fundamentalistic. It is not only about the language, it is about the tools and their integration. Think about games. Do you think they have the same problems as webengines? I don't say that Rust has not interesting ideas but I do not think it is solution for everything. Look at webbrowser. They are a really nice technology but they are very resources hungry. Most abstraction are eating resources. Developing abstraction which do not is really hard. That's why I argue for tools and practices which spend resources not at runtime but before. Rust tries to do that but it does it in a limited scope. If that is enough to break everything else will be shown by time.
@taragnor3 жыл бұрын
There's no garbage collection going on in Rust. Rust is just like modern C++ with smart pointers and move constructors, only the smart pointers and moves are better enforced. In fact with Rust you'll know when you're moving a value, compared to C++ where it can be kind of ambiguous what's going on sometimes. It's surprisingly easy to really hurt your performance in C++ by having hidden copies created behind the scenes.
@svenvandevelde1 Жыл бұрын
I have not yet understood why rust is so much better than C++. It is perfectly viable in C++ these days to program any program without pointers. I'm not sold on rust, and C++ will evolve over time also. As a matter a fact, it is good for C++ to receive some competition. JAVA was once the promise to replace C++, which it could only do to a certain extent, and today, it is proven that JAVA and C++ have specific use cases where they shine. Let us not forget that those safety guarantees that rust provides in terms of memory management, come with performance overhead and less control of the generated assembler.
@matinodoom5883 Жыл бұрын
I have a strange issue with Git bash terminal on my Windows 10 machine. Whenever I am prompted for something, the terminal continues as if I pressed Enter without typing anything. This makes working with terminal impossible, as I can't provide nearly any user input. This happens when i’m with rust and c++. It strangely does happen with other languages
@christianm490611 ай бұрын
It's been about 12 years since we first heard of Rust, and despite the extensive marketing campaign it has received, it is still considered a niche programming language. Don't get me wrong, I'm not saying Rust is a bad programming language. In fact, it might be better than C/C++ in many aspects, but its approach forces developers to either write everything from scratch or deal with the pitfalls of the 'extern-function approach' for integration with the outside world. The industry has invariably proven that this approach is a failure from day one. A very good example of this is the Dart programming language. It was originally intended to replace JavaScript, and despite being better than JavaScript in many ways, it miserably failed to do so. Similarly, Rust is unlikely to succeed in replacing C or C++. Rust and C++ are fundamentally incompatible. I see more future in replacing C/C++ with other approaches such as CPP2 or Carbon if the first production-ready versions of those languages are released, which seems very likely to happen soon. Once that happens, there will be even less chance for Rust to replace C or C++. Also, note that C++ and TypeScript are very successful languages in terms of adoption because their approach doesn't require rewriting everything from scratch. You just change the extension from .js to .ts in your JavaScript programs and start seeing results in terms of migration right away. Similarly, with C++ and C; you compile a C program with a C++ compiler and start seeing results. That's why industries are reluctant to migrate to Rust. This approach is in opposition to code reusability, which is too important to give up.
@rakeshgpt152 жыл бұрын
Very informative and helpful video. Thanks
@paranormal50423 жыл бұрын
I love the remote robot on the left, I have it as well 😅. Good vid btw
@Tomsudobrej2 жыл бұрын
Very clear, it helps a lot! Grazie :)
@FedericoTerzi2 жыл бұрын
Thanks! Glad you liked it :)
@onigumo3 жыл бұрын
Any other languages' No.1 issue: it's not C++
@lagmaster1023 жыл бұрын
fact
@llothar688 ай бұрын
I think C++ is much better because the memory management is easy and important to know. Forcing algorithms into the borrow checker is terrible. It's the safety fascism that managers now have. It's like taking the color black away from painters because this is a dangerous color that can't be overpainted and will ruin your oil painting.
@Leonhart_938 ай бұрын
Yes, that's the fundamental reason why Rust will lose. Learning to appease the borrow checker is a terrible way to understand computers.
@ManvendraSK3 жыл бұрын
I don't know but it looks like jQuery vs React/Angular/Vue. Though we still sometime use jQuery.
@AntiSmithhh Жыл бұрын
C++ and Kernel... There are little code in at least Linux Kernel which were created by C++. Rust is not wide part of Linux Kernel either (yet?).
@thegeniusfool3 жыл бұрын
I love how the ending "eh" is added to the last word in every single phrase, despite the English being *very good*. Stay real!
@FedericoTerzi3 жыл бұрын
Thanks! The Italian accent is a difficult one to get rid of :)
@鄭琮瀚-x2j Жыл бұрын
will Mojo language best then Rust?
@FedericoTerzi Жыл бұрын
Mojo looks interesting for sure! We'll see :)
@鄭琮瀚-x2j Жыл бұрын
@@FedericoTerzi Nice! Wait for your new video
@sheikhakbar20673 жыл бұрын
Which one is better to speed up python code?
@FedericoTerzi3 жыл бұрын
I think both of them are great choices! If you need to interface with existing C++ libraries, then C++ will be the way to go. If the libraries are in C, both Rust and C++ are easy to interface :)
@berylliosis52503 жыл бұрын
I came in here expecting this video to be completely biased towards Rust, and I was not surprised. Interesting how most people I've seen that don't like Rust haven't used it, and most that have used both C++ and Rust nearly unilaterally prefer Rust
@FedericoTerzi3 жыл бұрын
I completely agree with you, and I think it mostly comes down to ergonomics and friction to change. The usual argument against Rust (coming from those who haven't tried it) is that you don't "need" it, as you can do the same things in C++. I think it mostly comes down to the natural tendency of humans to resist change. On the other hand, Rust offers a much more ergonomic and modern approach to system programming, and once you get past the frustration with the borrow checker it really becomes a breath of fresh air
@bakugo40623 жыл бұрын
@@FedericoTerzi Hi. Should I learn C++ or Rust first? What do you think?
@dzarko553 жыл бұрын
@@bakugo4062 Depends on how much time you have. Are you a student, or are you going to start working very soon? If the former, I'd recomment Rust. You get a feeling for what code is bad, because you can't compile it in rust. So when you move to c++, you avoid a lot of errors.
@nullpointer17552 жыл бұрын
@joegoosebass Most people with little knowledge of C/C++ (like myself), preffer Rust because altough it can be a difficult language to learn, a begginer would have to deal with less painful things than learn C++. For example, the build system... The pain that is to have to learn how to build yout C++ project. If you on windows and use Visual Studio, it will be less painful, but if you dont want to use a heavy IDE, you will suffer. Have to learn stuff like MakeFiles and CMake, and i don't even have to tell you about integrating a extern library, right? Compiling for multiple plataforms is another pain... And of course, the memory management. Learn how to properly manage the memory of your program is not that hard, once you learn how to use pointers, the stack and the heap. And even if you learn to use smart pointers, you still can't escape from that one segmentation fault. Keep in mind that i'm telling all of this from beginner perspective (someone that never used C/C++ before, until now, only high level languages). So imagine that you are a begginer, and try C/C++ and encounter all these issues, and then you learn about Rust. Learn that Rust has a modern package manager that handles all of your dependencies and you dont have to worry about manually freeing the memory. And on top of all that, to build and run your project you just type "Cargo run" in the terminal. So ofcourse, Rust would be a better choice.
@gianni507252 жыл бұрын
@joegoosebass I have experience in embedded systems, in fact its what I love to do and I dislike web programming (always thought it was a codemonkey thing for the most part). Yes, I have even built my own OS with a WIP network stack (TCP pending due to lack of time but it will get there eventually). What’s ironic about all the comments I’ve seen so far is that you’re dismissive of people excited about a language that is basically objectively better than C++ in terms of almost everything (ergonomics, ease of use, verifiability, far less UB footguns, more powerful compile-time checking, better concurrency, etc) while only lacking in some areas (ie less powerful constexprs, lack of placement new, other small optimizations). You’re the one being a hipster, with no real points to back up your dismissive attitude other than that you dont like the community (aka exactly what a hipster does for everything). I dislike FP communities and yet I still see why they enjoy it and the benefits of certain FP constructs over usual imperative programming. The problem with C++ isn’t that it gives you “too much flexibility” or some other nonsense like that that is usually spouted, its the amount of footguns and UB you have to deal with that will bash you over the head with no mercy, that get in the way of your job instead of actually making something. Yes, modern C++ is a lot better about this. No, this doesn’t fix all the problems. Also the same knowledge base as in C++ is still in Rust. You’re used to the C/C++ abstract machine and you think its how computers actually function. What exactly about Rust is “abstracted”? As far as I see it nothing that isn’t also abstracted by the C++ standard library (ie string heap allocations). Is it because it calls regular heap allocations “Boxes” and shared_ptr “Arc/Rc”? Because believe me, all the same complexity is still there if you want it, its just far easier to deal with upfront.
@Jacob0113 жыл бұрын
I think you're right with regard to the future of C++ programmers. :)
@alicecgong Жыл бұрын
I disagree that less to no new feature will be developed in cpp. Rust doesn’t even have inheritance and its methods are implemented much more like C (declare a struct, then implement the methods outside with self as an arg), so it’s not as good for OOP, which is such a popular coding paradigm. I also personally don’t like how type declaration is optional and imho you can declare it sometimes and not declare it sometimes so kinda ugly (after having written C++ for so many years, I’m of course biased :P)
@Little-bird-told-me Жыл бұрын
Rust is better in memory safety. C++ is better in terms of compile-time and pointers. Rust is better in framework support, while C++ has better libraries than Rust. Object-oriented programming and game development are better in C++
@brailorjs11922 жыл бұрын
unsafe rust does not disable the borrow checker, those memory guarantees are still valid. This video sounds like it came out of a Wikipedia page.
@pioneer_11482 жыл бұрын
From what I can see we're increasingly heading in the "if it can be built in rust it is" direction.
@yuvrajagarkar89422 жыл бұрын
so its recommended to learn rust over c++ right. ?
@FedericoTerzi2 жыл бұрын
If you have the time, I'd say start with C++ and then move to Rust (as a lot of things will make more sense) :)
@yuvrajagarkar89422 жыл бұрын
@@Wariowa345 I already know c++ learnt it during DSA
@Spartan3223 жыл бұрын
tbh I hate Rust's syntax so much, C++ can have its annoyances, but Rust outpaces all my problems with C++ as a language and I don't feel that Rust really solves the problems of C++, it just recontextualizes them which I find stupid tbh, especially with how it treats structs and generics.
@FedericoTerzi3 жыл бұрын
Rust has a very "interesting" syntax indeed, I remember hating it at first as well! I don't know why, but after a while it "clicked", and I started to really appreciate some of the features, such as pattern matching and conditionals as expressions. Coming from an object-oriented language, Rust can feel strange and takes a while to get used to :)
@Spartan3223 жыл бұрын
@@FedericoTerzi I'll never be able to come around to a language with postfix type declarations, there is no reason to do it inherently, (I kinda understand it in Typescript [tho Typescript writers should be punished for it anyway] and Python, preexisting infrastructure kinda forces your hand) I hate Rust's syntax because it doesn't want to remove any of verbosity that C++ has, it just shifts into a new syntax instead of fixing it. Languages don't need to naturally be verbose and neither should they decide the paradigm you should use, C++ is great because it doesn't tell you what to do, you don't need to use any specific paradigm to get anything done, Rust, C#, Java, JS, Python, pretty much every other language sucks here because every one of them forces you into some type of paradigm to solving problems, and pretty much everyone of them strips the power of C++ away that they never needed to do. I also hate shorthanding the primitive type names, that was not a problem in C++, I have no idea why every single numerical primitive type needed to be named that way. I already am annoyed as is with separating functionality and data in C++, I don't like having to write declarations and definitions, but once again instead of fixing that, Rust does the opposite and just pushes it into two new keywords instead.
@FedericoTerzi3 жыл бұрын
I understand your frustration, though I think the freedom that C++ gives you is a double edged sword. Every C++ project adopts different conventions, which (IMHO) makes it more difficult to collaborate. This is usually not a problem in Rust
@Spartan3223 жыл бұрын
@@FedericoTerzi I don't find that a problem because I don't believe its a language's job to define the paradigm for the developers to use, its job is to define a consistent manner in which its syntax should translate to executable code, (C++ can fail that, which is a problem that nobody actually tries to solve) code styles exist in every language and most IDEs can and do handle that for you anyway, (or even no IDE, clang format exists for example) C++'s worst aspect on this is because of ABI legacy and C legacy, both of which C++ has to retain, a new language could've gotten rid of that without stripping the whole of C++, it could've done templates better in a way that keeps most of the power without generating the most atrocious problem with templates that being the error checking, SFINAE is not a bad concept so long as its an intended behavior, which it wasn't in C++, everything about templates that's powerful is an accident. It wasn't designed to be Turing complete, it was accidentally Turing complete. The same could've been said for modules, personally I don't think its the language's job to figure out its package infrastructure, (and I don't mean leaving the problems with a standardized compilation method like we have in C++ where we need CMake, having something that does that for us with the power of CMake would be nice without having 20 different standards) I like separations of standards and power, C++ modules is about the furthest I think we should have, everything else is not the languages job and is just excess bloat, especially for design. Operator overloading in Rust makes me sick, C++'s object model is simple and functional, you can clearly see what's going to happen even if you shoot yourself in the foot. I would love to have a more robust C++ without burning it all to the ground and replacing it, and I really don't want Rust in any of that, I don't even like the keywords in it and its overly-verbose nature is a huge pain to both read and write. Macros in Rust are cool, but I don't like how it makes up a whole new syntax you have to memorize. Also hate when languages define file structures, the organization of files should be irrelevant to the compiler so long as they can be linked. And I don't see why modules in Rust need to be called modules, Java was stupid enough to call namespaces packages, there was no reason to change that imo, just seems like screwing with things for the sake of it. All the things Rust does seem to be arbitrary mostly because they don't relate to existing behaviors in any other language and it just wants to make itself seem different. Instead of making itself relatable, it really does seem to do everything it can to not look like C++, which is even more of a pain in the ass if you want to translate from C++ to Rust, if its supposed to replace C++, it makes no sense to increase the barrier to entry by leaving only some things from C as familiar in Rust.
@taragnor3 жыл бұрын
@@Spartan322 : Paradigms are good things. They were established to cut down on bugs, make the code more readable and help with maintaining the code. When you're working on small solo projects it can seem like a giant waste of time, but work on anything large and having a coherent, effective programming paradigm is essential. Even in languages like C where anything goes, there's often strict standards for projects like the Linux Kernel for example. If you ever want to code anything with others, you will need to learn and follow a paradigm, regardless of what language you use.
@butterbean_012 жыл бұрын
Ottimo video, grazie!
@imveryhungry11211 ай бұрын
C++ is for men rust is for baby 😊
@v3003 жыл бұрын
So, Rust more like Managed C?
@youarethecssformyhtml Жыл бұрын
Yep with better error messages
@rileyowen72456 ай бұрын
Rust is better but C++ huge community support, libraries and frameworks. Many big tech companies using cpp . This why i don't want to switch.
@channelname10yearsago682 жыл бұрын
Imagine calling c++ legacy. Emotional damage
@AD-nm7ne11 ай бұрын
However, Rust does not have proper libraries and standard documentation. lol
@FedericoTerzi9 ай бұрын
Did you check the Rust documentation? It's one of the best available :)
@philmarsh77232 жыл бұрын
A C interface is not a C++ interface.
@ferchuu93 жыл бұрын
You forgot to say that the Linux kernel guys are thinking of including Rust, although Linus doesn't like it at all
@arian51263 жыл бұрын
Linus is right. It's a fucked up lang. Don't be fooled by those saying it's got a nice community and docs and stuff like that. It's bullshit.
@ferchuu93 жыл бұрын
@@arian5126 Can you elaborate? why is it so bad for kernel development?
@arian51263 жыл бұрын
@@ferchuu9 I said it generally, not necessarily bad for kernel development, but bad for all other stuff. Don't be fooled by them saying they've got nice documentation/community. It's a lie. They're delusional. Btw kernel development has got a very strict set of rules and many specific APIs that you must use or your patch/code won't be accepted for the official kernel. A good programming language has to have balance between learning curve and productivety and Rust sucks so bad in both. You don't see jobs for it as well. I liked their idea of memory safe programms but their implementation is terrible. I studied Rust for less than half a year and when started coding, it was such a negative experience. I switched to Go.
@StingBolt3 жыл бұрын
@@arian5126 golang fanboy spotted, yall really get triggered from rust? lol
@cristianolacerda98713 жыл бұрын
the Linux kernel never used C++, only the good old C.
@thebestofperaable3 жыл бұрын
Per caso sei italiano?
@FedericoTerzi3 жыл бұрын
Yep :)
@Alessandroale742 жыл бұрын
@@FedericoTerzi perché non crei anche la versione italiana dei tuoi video ? Altri lo fanno, raddoppieresti i follower magari.
@sr567 Жыл бұрын
Interesting thing about Rust. Many people miss the review, Rust is not just system programming. It is becoming versatile like python
@Luxcium3 жыл бұрын
It’s important to remind people to subscribe and Like 👍🏽 and today you have me as a new subscriber (in the specific case ✅ it was useless to ask me haha 😂 you deserve it for your well explained topic!!!)
@FedericoTerzi3 жыл бұрын
Thanks! :)
@YannMetalhead3 жыл бұрын
Good video.
@kamertonaudiophileplayer8473 жыл бұрын
Add also Go.
@FedericoTerzi3 жыл бұрын
It's been there for a while :) kzbin.info/www/bejne/kHuZlYmMpMedl6s
@philmarsh77232 жыл бұрын
What would happen if someone (or a group) wrote a C++ like language definition which gave all the safety of Rust but the syntax of C++ so we didn't have to learn a whole new syntax? Would this have been possible?
@dynfoxx2 жыл бұрын
Unfortunately no. C++ does not have ways to express things that rust uses for safety. Even if we added them we would have to change the meaning of existing API'S and language features. You could get something closer to C++ but it may not be as nice as you wanted.
@yotty973 жыл бұрын
in 10 years time c++ will just be maintainence jobs? LOL -- call me when there's a Rust equivallent that even comes close to the rich ecosystem of Qt. Qt is THE reason so many projects are written in c++.
@godnyx1173 жыл бұрын
Qt is bloated af!
@yotty973 жыл бұрын
@@godnyx117 lol, compared to what, electron? electron is bloated - and memory hungry. Qt is light-weight in comparison.
@christianm49063 жыл бұрын
@@AlirezA_Ahani that's going to be difficult as many patterns in Qt rely on OOP and inheritance whis is not supported in rust.
@christianm49063 жыл бұрын
You are totally right. Qt is a very powerful c++ framework which has been built for at least 30 years. Not even flutter is close to what Qt has done so far. There won't be anything like that library for rust in at least 10 years. Perhaps there will never be something like that available for rust.
@tomtravis8583 жыл бұрын
gtk?
@nerdion19113 жыл бұрын
Why do you sound like a Netflix dubbing artist for Nordic people ? ! xD
@FedericoTerzi3 жыл бұрын
So that I have a plan B if my software engineer career fails :)
@nerdion19113 жыл бұрын
@@FedericoTerzi if you can help on understanding Rust then it would be really great!
@osys78322 ай бұрын
all the way down to the c++
@gabrielcastilho41682 жыл бұрын
You can't make a "which one is better" video and end it with "it depends"
@FedericoTerzi2 жыл бұрын
Why not? :)
@gabrielcastilho41682 жыл бұрын
@@FedericoTerzi Because you're not answering the question. It's a clickbait, then
@Karma-vf2qu3 жыл бұрын
Grandee
@prodevus3 жыл бұрын
Everytime this guy pronounces Rust it says "rasta" in the automatic captions
@christianm49063 жыл бұрын
As far as we know, all efforts to replace C++ in the past have failed.
@Artaxerxes.3 жыл бұрын
Lex Friedman asked if the c++ compiler would be rewritten from scratch. And bjarne said perhaps it would be. Can't wait for that day. The language will be terrifyingly fast
@ChristopherGray003 жыл бұрын
@@Artaxerxes. It's already extremely fast, in large projects it can manage to be faster than even C itself due to its abstractions. The only reason they would make a new compiler is for memory safety most likely.
@taragnor3 жыл бұрын
C++ hasn't had a lot of competition. I mean, besides C/C++, there aren't many systems programming languages. Already in a lot of areas where speed or low-level code isn't required, languages like Java and Python have gained hold over what used to be C/C++ territory. Rust is the first serious challenger to take on C/C++ on systems programming. As far as 'replacing' c++, that's another story. Programming languages have an incredible amount of inertia because of all the existing code. Totally killing or replacing a language is largely impossible. Some places still use COBOL. Once a language takes hold at all, it's going to at least be on life support for maintenance jobs for at least half a decade.
@ChristopherGray003 жыл бұрын
@@taragnor The way i see it is that it's very rare for a language to replace one another and we shouldn't ever expect that to be the case unless it is a language made to be an upgrade or successor (python 2.7 -> python 3.x for example) C++ never replaced C, it was always another option on the table for programmers to pick, with its advantage of flexibility but with the disadvantage of making it arguably easier to shoot yourself in the foot by accident.
@taragnor3 жыл бұрын
@@ChristopherGray00 Yeah I suppose it really depends what one means by "replace." It's not going to be the case that you'll ever get a ton of people that are going to suddenly rewrite all their existing software in some new language. That almost never happens. It's not going to be the case that every C++ project gets rewritten in Rust just isn't going to happen. What is C or C++ will remain in that language. When it's said that Rust will replace C++, it basically means that businesses start to use it for new projects. For instance, COBOL used to be big among companies but C++ and Java gradually replaced it. There's still COBOL code that's being used and maintained but you won't see new projects started using COBOL. That process will likely take a lot longer with C/C++ simply because it's the basis for the operating system code right now.
@dehrk90243 жыл бұрын
c++ is better because i dont know rust
@ric8248 Жыл бұрын
the bias is too blatant :/
@vladimirkraus14383 жыл бұрын
The strongest point for C++ is called Qt.
@FedericoTerzi3 жыл бұрын
I agree, Qt is still very strong in the enterprise market and it will probably be for the upcoming years
@TinyTeaKettle3 жыл бұрын
Also it's weakest point. I mean, Qt is awesome. I'm in love with QML and the huge functionality that QT brings. But Qt also does infest your code with it's own types everywhere which makes encapsulating the UI part from the "backend" code annoying if you want to have std library code as a basis.
@yotty973 жыл бұрын
@@TinyTeaKettle Yeah. I've spent the last 2 months untangling a core part of our code base from qt and moving into a shared library. Total pain in the ass! Qt types are great, especially the QString type; but c++20/c++23 is almost catching up.
@ad7711xАй бұрын
I chose Rust over C++ because it's 10 times easier to create GUI for it.
@dejayrezme86173 жыл бұрын
I gave up on C++ because the build toolchain and dependencies are just an endless horror. So yeah you have tons of libraries but each one can become a multi day struggle to integrate.
@danielcoffman10223 жыл бұрын
Rust is definitely far better than Java. I believe Rust may even replace Java. Java just has too many layers to it
@abdullahabd76773 жыл бұрын
👍👍👍
@sj245604 ай бұрын
hello
@SportSync_official2 жыл бұрын
Can't compare them. C++ is embedded in current software. Rust is better for newer applications.
@FedericoTerzi2 жыл бұрын
For sure, Rust is a great choice for new software! :)
@pedromiguelareias Жыл бұрын
It won't happen.
@sefovsky3 жыл бұрын
C#
@nixon62162 жыл бұрын
Bro, You keep flash banging us with that bright ass white screen. dim the editor in the future
@itay28263 жыл бұрын
I'm not going to lie.. I'm probably the most lazy man I know but I want to start learning to code (I don't know any Programming language except really really noob level py but I'm 14 so I guess it's not soooo bad Situation) and I don't know if should I start with py, java, js, any c (I know they are nothing alike) or rust and I will love to hear from you what do you think because when I starts something I'm putting my whole time to it.. so I want to be sure I started with the best (I knew that I need to know more than one language and that I have a lot of time to discover myself what language it's the best for Me but I want your advice as a very smart and experienced guy) so.. ?
@FedericoTerzi3 жыл бұрын
Hey, I'd personally keep studying Python as it's by far the most approachable and you can do a lot of powerful things with it! After you got to a good point with that, you should ask yourself what you want to do next, as the best language depends on the use-case: * Web applications -> Javascript/Go * Mobile applications -> Kotlin/Swift/Dart (flutter)/Javascript (React native) * Machine learning -> Python libraries (Scikit learn, Tensorflow, Pytorch) * Games -> C# (unity) / C++ * System programming -> C/C++/Rust I would not choose Rust or C++ as your first language, as they are pretty tricky at first :) Best of luck with your journey!
@TinyTeaKettle3 жыл бұрын
@@FedericoTerzi To be fair depending on where you wanna go like C++ I would rather start with Java as it isn't as different to other C syntax family languages as Python is. Although you are definitely right as Python is excellent for learning.
@FedericoTerzi3 жыл бұрын
Yes, the Python syntax is pretty far from C-based ones. At the same time, I think it's still a great choice for learning because it's so easy to reason about algorithms without worrying too much about the language. As always, it depends :)
@TinyTeaKettle3 жыл бұрын
@@FedericoTerzi Thats true. I've just had enough examples of students that haven't had any experience in programming prior to university and had some trouble understanding the basic concepts of programming. In the end a mixture of both languages might be the best approach. Basic programming concepts in Java and algorithm and advanced stuff in Python? And even more important (that many students I knew didn't take into account). Programming. Just programm stuff. Simple things. Doesn't matter. Just keep practicing. The magic behind everything. Practice. Should be printed on every damn book in huge golden letters. PRACTICE. xD
@FedericoTerzi3 жыл бұрын
Definitely! Practice makes perfect :)
@joshuachan63172 жыл бұрын
Lol the problem boils down to Rust or Carbon now
@امینمالکنژاد3 жыл бұрын
good job i like you
@FedericoTerzi3 жыл бұрын
Thanks!
@_slier3 жыл бұрын
Neither, *Zig* is the answer
@FedericoTerzi3 жыл бұрын
I've heard a lot of great things about Zig!
@_slier3 жыл бұрын
@@FedericoTerzi come join the dark side.. you wont be regret.. unlike rust that need ffi to use c libs, in Zig, u can straight import c header file and use it.. rust is overly complex language.. even doing linked list in rust is a headache..
@leefoster41333 жыл бұрын
C is long past needed to be removed from the scene.
@brumels15702 жыл бұрын
a language lives or dies by their libraries. one reason why perl is dying and python and java are thriving. how is rust's?
@FedericoTerzi2 жыл бұрын
Not as mature, but growing fast! :)
@Shaphil Жыл бұрын
unsafe side == the dark side (。▼皿▼)
@PlatinumBuckGorilla3 жыл бұрын
HTML is better than these two combined.
@biskitpagla3 жыл бұрын
yeah and brainfuck is a great scripting language
@mistakenmeme3 жыл бұрын
Based
@x7themm2 жыл бұрын
You’re going to war: Rust - a nerf gun C++ - an AR
@tjgdddfcn2 жыл бұрын
c++ is an AR that has a chance to explode whenever you shoot it
@x7themm2 жыл бұрын
@@tjgdddfcn when you don’t know how to use it, because you suck 😂
@tjgdddfcn Жыл бұрын
@@indiesigi7807 sure
@Leonhart_938 ай бұрын
@tjgdddfcn But then Rust will get stuck every other bullet because it didn't liked how you held the gun 🤣
@affegpus4195 Жыл бұрын
Easy question! Rust is better, why? Becouse is not c++
@mannycalavera1212 жыл бұрын
Rust
@rickdeckard47353 жыл бұрын
The thing I don't like about Rust is that it seems to be infested with cringy leftist hugbox politics