Why I Hate Rust (the programming language)

preview_player
Показать описание
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Рекомендации по теме
Комментарии
Автор

I used to have a similar stance to yours, thinking that the memory safety guards rust provides are not necessary and are for people that don't understand the true nature of computers and how to harness their power. However, I've come to realize that we are only human. NO MATTER WHAT you do to try to prevent memory management bugs from creeping into your codebase, they will always be lurking in the shadows when using languages like C and C++. And sometimes, thats okay. But, when you take a step back and look the broader spectrum, it's very evident that the unsafety of C and C++ has cost the industry unimaginable amounts. Rust is built with rigor. Where C and C++ can let small things slip straight through your fingers, rust is there to catch them. Don't quote me on this, but I read somewhere that Microsoft has openly stated that memory unsafety can be held accountable for over 70 percent of all security issues across all of their platforms. Just imagine a world with 70 percent less security bugs.

adriankern
Автор

1. Cargo is a toolkit. It handles 'crates' that are either stand-alone programs or libraries for other programs. You can use it to initialiaze projects, add dependensies and use the 'Cargo.toml' files to compile your project. (much like 'make' files but much simpler. holy **** make files are a mess of a design.)
You 'can' use it to install software too but not sure if that is the way people actually use it. You can also extend the cargo toolkit yourself.
What is the compiler for rust then? it's 'rustc'. You say "it shouldn't be so complicated that I have no idea what it is" when you didn't even read the manual. RFM
2. While juvenile argument of level of intelligence is bit dull. How memory is used is very much still a thing with rust. Difference between C/C++ and rust memory management that with C you are allowed to do dumb things with memory. In rust you use memory with scopes or annotate it with lifetimes. Complaining rust programmers don't have to allocate memory is like complaining you don't say grace before eating... silly or ignorant AF
3. 'cargo install' has settings and environment variables for your preferred install location.
4. Filesize! If filesize is important for your use case, rust can optimize a lot. You can optimize rust release builds for filesize, performance speed etc.. just like most optimizations, it comes with trade offs. pick your poison.
5. Yes. crates.io index is big. but if you don't want to use it, you can also configure your cargo toolkit to go offline mode. or use alternative sources for your packages like git or direct URLs etc.
Also since we are talking about 'developer' usecases... most of the libraries you download are things that other developers use to build their macros or language features that they found useful but are not part of standard rust yet. You don't need to re-download or build everything if you already have it downloaded or built on your development environment. It's not like you download 'boost library' every time you want to compile new project...
6. people who are stuck in their C land or does hardware / baremetal programming are using unsafe. latter for a good reason. 'unsafe' just allows you to do few things that if you don't know what you are doing might cause undefined behaviour. Usually this never becomes an issue if you are not trying to imitate the conventions you might have stuck with you when learning the C language. "So many people end up wrapping their code in the 'unsafe' function", no they don't. 'unsafe' doesn't turn off borrow checker, new rust developers have issues with borrow checkers, not the unsafe/safe thing. Only people with 'unsafe' issues are former C programmers who can be bit silly.
7. Easier syntax does not equal higher level language. Assembly, or better yet, literal machine instructions are extremely simple syntax. Higher level language is number of abstraction in between it and machine instructions. To be honest, C/C++ and Rust have pretty much the same syntax with different language features. I guess the biggest difference is that rust has more short hands when compiler can infer things like types from your already existing code. rust-analyser is great tool if you want to have insight into what compile issues your code currently has in almost real time and what types it can infer, and what requires you to be more specific. When compiler does it's magic it expands the code into the inferred types and that syntax can be bit overwhelmingly specific.
8. "rust programs end up using more memory" again, optimization option. Defaults to cpu performance. Modern hardware has extensively more block storage and memory than we use. If we can trade that for faster execution then why not? If your use case needs to optimize for other things, that is your choice to compile it with those options and optimizations.
9. There are many reasons to re-write program. 1-to-1 rewrites for benchmarking compiler. feature-to-feature rewrites for language feature benchmarks. Novelty...
Actually important reasons for rewriting with rust though? We have now about 50 years of technical debt running on our unix based servers. new attack vectors found every other day. most come from exploiting software memory access to write things in memory locations the running software was not supposed to access to and doing things like arbitrary code execution or privilege escalation. within last few years we have had to patch even the simplest standard programs because someone found new exploit.
10. "C is harder", eating soup with chopsticks is hard. I still don't think higher of people who do it.
I've learned many languages. JavaScript, Lua, Python, PHP, C, C++, C#, Java, Go.
JavaScript is just hotpot of things done 'just because'. Lua is weird AF because every stack that implements it does things slightly differently. Python is 'ok' but relies on so many things not-python to do things that it's more of a tool to experiment or to create proof of concepts with. C/C++, when working with only standard library, they are fine. When messing with application solutions that require bunch of dependencies, it can become pain in the ass. C#, only really used it with Unity but it was pretty cool, in it's isolated environment, .ASP/.NET stuff is just weird Microsoft software chain bullshit. Java, is just C# but with Oracle. Go is pretty cool. Their libraries are always out of date that you have to fix yourself.
Rust, while I am still not confident with it, has been most fun to learn. I've never seen compiler tell me in almost plain English what I am doing wrong or suggest how to fix it.

In conclusion, I think you made this video mostly just to bait people to interact with the video. Good hustle. But I don't think you can give honest opinion on language you have not given actual attempt with. Yes! You learned C, congratz! Someone invented new language that *might* be better for things C was originally used for? We call it progress. Rust keeps much of C/C++'s syntax because it worked and is familiar. The things that hindered the language was discarded. I am much happier with Rust, writing it is fun. Knowing my programs wont have memory access errors or page corruptions (**** you PostgreSQL) makes me very happy.

After I got done with the exercise, when I first started to learn rust, I had fun expanding on it with a config file reading and serving files based on extension using different pre-processors.

otso
Автор

Calling someone unintelligent for their choice in programming language is like calling someone weak for their choice in hammer weight.
How much work are you really getting done if this bothers you?

wheezybackports
Автор

"I guess, maybe, like a toolchain?"

Yep.

You really sounds clueless when talking about this stuff. Cargo is a frontend to the rust developer experience. It's easily the best one I've used across dozens of languages. It mostly just works. It's not a compiler, rustc is a compiler, but cargo acts as a frontend to that. It also acts as a frontend to linkers and is the package manager. When you said, "it's not doing any of them very well, " I'm super curious what other languages you're working in that you find excel in this space. Maybe python does a decent job here, bundler is OK, composer is OK, everything in C++ is a nightmare, but Cargo just works.

askreet
Автор

Having done a lot of embedded programming in C and C++, I can understand where Rust is coming from. But having been in the programming professionally forever now I can see the problems of forcing you to do things in a "certain way". The correct way seems to change every so often and soon the establishment will be telling you Rust is doing it wrong. C and C++ has survived for so long because they don't strictly impose a programming paradigm on you. AI is also a game changer in terms of generating code and tests. Memory Safety thing that Rust is all about becomes less of an issue if AI can now generate thousands of test cases for you so you can catch UB edge cases.

Don't get me wrong I don't hate Rust at all. But I also don't easy buy into the kool aid. I am old enough to remember when people said C++ is dead and Java is taking over. Then there was the Binary -> XML->JSON->Binary (GRPC) we came full circle lol.

ApplePotato
Автор

I used to strongly dislike rust. Spent years using Haskell/Python/C etc. When I finally tried it, all the small design decisions made so much sense! Not to mention the extremely clean official guide. I mostly use Rust now, with python as a convenience language to get prototyping done quickly. I'd suggest you give it a serious try, you might end up loving it :)

Adityarm.
Автор

I'm not sure how familiar you are with programming larger scale programs that require real-time performance and/or security. A lot of your complaints about Rust are less about the language and more about tooling and some of them just apply to the modern software world.

> UNIX philosophy

First, UNIX is dead. Second, the UNIX philosophy does have a point in avoiding programs to be tightly coupled, however, a program having multiple functionalities is not a bad thing either as long they are coherent to the purpose of the program and not tightly coupled. The Rust (and Go) tools support testing, compiling, dependency management and profiling. All of those functions are mostly orthogonal and they are coherent, these are things programmers of all levels do, separating those into binaries makes the system arguably more "bloated" and complex.

> Cargo

I agree cargo isn't very good, in fact, most "language package managers" are horrible, but they exist for 2 reasons:

1. Your OS package manager is also horrible if not worst (also it isn't portable)

2. These languages have a complex ecosystem for a variety of reasons, and unfortunately they define a "package" to be something way more complex than it should be, making these big tools a *requirement* not an option for managing software.

Also, not installing to /usr/local/bin makes sense, as it would require root privileges, npm can install to /usr/local if you pass the -g flag.

> Dependencies

The tendency to have hundreds of deps for a trivial program is an unfortunate reality of modern computing, it doesn't have to be this way, but most developers (and especially their customers) don't care.

> Rust

Rust's big binaries are (mainly) a result of rust preferring to make binaries mostly static, so no dynamic linking(except when it does), by default the binary's symbols are not "stripped" which is a bad default for release builds but you can fix that on the TOML file pretty easily.

I'm not sure what you mean by bigger memory usage, I have no metrics on that one.

Rust has horribly slow compile times, its syntax is *not* simple, but that's the price for a very good static analysis tool being built-in.

The usage of 'unsafe' does not in any way defeat the point of the language, A program that is 99% guaranteed to be "safe" *is* better then one that is only 10% guaranteed. At least with unsafe it becomes explicit where possible memory issues could be coming from, where in C/C++ they can literally be anywhere.

> Rust ""Community""

It's trash. Just like most online "communities", they somehow are more insufferable than the modern C++ crowd. I agree COCs have no place, but this isn't a issue for most users and even developers.

In conclusion, I'm not a rust fanboy, I really don't like the language but it makes sense in its original niche. One language you might enjoy is Odin, it is simple and made for modern systems, it fixes most of C's glaring mistakes and has been very nice to use.

marcs
Автор

11:36 Programs rewritten in Rust often do have some extra features that make them really nice, like for example, Exa which is an LS clone with features like icons and colors.

oglothenerd
Автор

I'm curious, you compared the number of dependencies between Rust and C and said when you compile your C projects they have much less dependencies and those dependences download quickly -- what are you using to install C project dependencies?

I think it's important to remember that if you're on Linux, your OS _is_ the C package manager. You've just already downloaded them all.

askreet
Автор

Elitism shouldn't be justified by saying the people in the Rust community are elitist, so I should be an elitist calling a person who uses Rust less intelligent. If someone or a group of people does something wrong, you should do it as well? Also saying that people who use Rust to write programs are less intelligent says more about you than Rust as a programming language.

fellowproghead
Автор

As a former C programmer, Lisp is supreme.

ariabk
Автор

The main reason is the C cheat on its binary size by pre-distribute its standard library. Rust cannot assume it so it statically link its stdlib within the binary. In my environment uncheated C binary compiled with gcc -static main.c takes 872 kB.

To force Rust to dynamically link programs, use the command-line arguments -C prefer-dynamic; this will result in a much smaller file size but will also require the Rust libraries (including its runtime) to be available to your program at runtime.

feltrix
Автор

Rust is for those who aren't smart enough to manage memory at 2:59
Maybe, but I can see the appeal of memory safety *by design* . Programmers are humans and humans make mistakes. All sorts of tests methodologies have been designed to catch those human mistakes.
I'm not saying Rust is great (I don't like Rust much), but if a language can guarantee *by design* the absence of a whole class of bugs, it is a really good upside that appeals to a fringe of programmers whose intellect does not have to do with the choice of the language.

unperrier
Автор

There is an argument that making good Rust programs is easier than making good Python programs. I can't confirm it since I have not tried making anything serious in Rust, but the argument seems reasonable: rather than writing unit tests, you model the valid states of your program using structs and the transitions between them using impls, then if there is any runtime problem, the compiler spits out an error so it can be corrected.

kkiller
Автор

"Memory safety is for dummies that can't hack it in C" (paraphrasing). I think this is an argument for the young and foolish. It is based purely on ego rather than engineering wisdom.

ryanleemartin
Автор

Ref: your complaint about binary size.

Newbie here, but are you using -release with your build command? From the documentation I understand that tells Rustc to optimize your binary.

mikemardis
Автор

Firstly, before I start, I'd just like to say that I wish you did more research on this. The Rust docs, and the Rust book explain easily in detail most of what these tools do, and many of your points could be made more clear if you'd known this.

Now to make it clearer:

- Cargo is a package manager. That is it. It's neither a compiler, nor build tool.
- rustc is the compiler, and cargo uses it to compile code
- The many other commands cargo supports (i.e. cargo fmt, cargo clippy) are all **optional** and are separate tools (rust-fmt, and clippy)

For your extra memory safety thing, I'd rather put it's both ways. Memory leaks take up a large majority of the bugs on projects like Linux, Windows, and many more. Having a tool be able to manage memory for you to prevent leakage is, in my opinion, logically smarter (hence why Linux uses Rust for some things now).

One thing I'd like to say as well is that you bring up cargo a lot of times. To me, it feels weird bringing up what is essentially an optional module (there are a lot of other Rust package managers) in a discussion about a language. It's like bringing up npm in a discussion on why node sucks.

As for the bit about why cargo doesn't put build outputs in the bin, it's quite simple and I don't know why you don't get it. Let's say, someone wants to build a simple library, why should it be put in the bin?

For the binary bit, are you sure you built with `--release` enabled? If not, then you're probably running an unoptimized build which perse is much larger. And, in my opinion, the many things Rust does to simplify your development and propel your skills further are well worth the mildly bigger binary sizes.

I think now, for your index part, it's more of a personal thing. In my own experience, at max, the index only takes about 1 minute with the same speed (about 10mb/s).

The point about most people grabbing code into the unsafe function, in my experience, is false. I've only seen around 3 Rust crates use unsafe code and that's mostly because they are either using C code (the language your vetting for), or because they are doing some extremely low-level things.

As for the reason I like Rust better than C is a myriad of reasons. Those being of course:

- Better Memory Safety
- Generally Better Syntax
- Near Zero-cost Abstractions
- The Amazing Type System
- The awesome toolchain and ecosystem around Rust
- The great community support
- In most practical cases in faster in terms of literal speed, and development speed

and much more which, in my opinion, makes the language well worth it. I do get though, as I have been doing myself, Rust is not for everything.
You probably shouldn't be using Rust for web development yet (it's under developed really, ) and many other things.

Deep down though, Rust can do all the low level things C can do, which does make it on the same level as C, just with many optional abstractions. But also, in my opinion, C is most likely not the best comparison to Rust. Rust was, some time before and still now really, made more as a modern C++, and in many ways and in my opinion it has achieved that goal and has even transcended that. I doubt it'd ever be as fast as C, but it can always be close to it, and in the end will always be easier than C.

Rust is modern C++, and Rust is C for the 21st century.

vercal
Автор

I agree with the statement, "If you can code in Assembly language then the title of Elite is warranted." The only thing (so far) I do not like about rust is that it takes a long time to compile. I use Gentoo Linux as my primary computer (because of hardware & Steam mainly) and I was a bit horrified that all this Rust code was suddenly in many applications as if Linux said, "Hey, a new programming language. Let's all use it and see what happens, wheeee!"

I experimented with Cargo using "exa" which is supposed to replace "ls". In scripts it may be better but on the command line it is one extra letter to type unless you create an alias. I suppose with the new features it may be superior to "ls" but I seem able to do everything with "ls" that I can do with "exa" so I'll keep using "ls".

One disturbing aspect of Rust is how integrated it is with git repositories. I suppose this centralization aids in efficiency but from a security perspective I have concerns about software integrity. Maybe I'm just paranoid due to my OpenBSD usage and my agreement with its philosophy.

bufordghoons
Автор

Cargo is an absolute dependency hell. If one thing is missing, it will not continue installing your dependencies in order to compile one program. Although yes Python is easier, it also suffers the same issues.

EdnovStormbrewer
Автор

As a hobbyist programmer, I really hate Rust. While coding in Rust, I always have to think about ownership and have to wrap many variables with Rc<Box<>> or Arc<Mutex<>> even when I know I don't need them at all.
However, I understand why people use it. As codebase glows, people can't just comprehend all of it, then end up shooting themselves in the foot. So, Rust is not something people should love, but people need.

long-live-linux
welcome to shbcf.ru