Comments by "Anony Mousse" (@anon_y_mousse) on "No Boilerplate"
channel.
-
I feel like you're trying to trigger me by equating C and C++. They haven't been equivalent for at least 26 or 27 years now, depending on which standard you work from. I would consider C++98 to be the great split, but some others would say C99. If you knew C++, you'd realize that Rust is an attempt to replace it, not C. You could still go your entire career using only one language, and there are many, many candidates for that position. However, why would you want to when using multiple languages is so much more fun. While I've mostly used C in my career, I've done a lot of C++ and assembly, and a few other languages.
I'm hoping that in this field I'm not unique in this regard, but I enjoy learning new things. I've been learning Rust for the last 3 or 4 years now, and I've also been working on learning at least a dozen others. Aside from learning new languages I've been trying to keep up with new developments in the languages I already knew. And on top of all of that, I've written various C compilers for work before and have been working on a language of my own design as a personal project for a long while now. I don't think that we, as developers, should stick to only one language, and I wouldn't consider such a focus healthy for our well-being.
2
-
1
-
Maybe I just need a better example to help me visualize generically how this could be applied because that link which talks about HTTP requests seems convoluted and full of too much boilerplate, which kind of seems like a natural negative consequence of how Rust implements enums. For instance, if I were implementing a mechanism to handle requests, I'd put everything in that one class, and there would be no need to return different structs or whatever.
This also kind of strikes me as one of the quirky flaws of method chaining because then you have to return different types to allow the chain to continue. Of course, since we're talking about HTTP requests, I'd probably just fill in default details and have functions to let the user replace the defaults or not if they shouldn't care. Certain things would obviously be an error, like a lack of target IP and so on, but there are things which the user might not want to care about, or shouldn't have to manually handle.
For instance, one of the things about the example that strikes me as wrong is the status codes being passed as magic numbers/strings instead of having a set of enumerated names so the user doesn't need to know the actual status code, such as just STATUS_OK instead of passing (200, "OK"). And on top of that the content length being set by the user passing anything at all. That's one of those things that would never be explicit in such a library were I writing it because the user could pass the wrong value and that's a huge flaw, where instead the library should calculate it for you and set it automatically.
The two examples he gives of where such things go wrong in C++ I agree with, but they're also kind of irrelevant. Sure, move semantics should probably be implemented better and more at the compiler level, but things like closing files really is better with RAII and it's just a matter of slightly modifying those classes. Of course, I don't agree that Rust actually makes these things easier or ergonomic as that code looks disgusting and makes me want to barf worse than reading STL code in C++.
1
-
If there's one thing that has been pounded into me over and over again throughout the years, it's that new trendy languages are meant for people that don't actually understand how computers work and don't know how to program. Unfortunately, the lies told by the designers get perpetuated and a vast quantity of people get tricked into using these languages, and thus what should have been a couple of months of trending turn into a decade. Sometimes they even mutate into unholy monsters that take over the world like JavaScript, or they take over a few fields like Python, but even the somewhat niche languages still get used far more than they should. I've never seen a cult this strong though, and the more I learn of this language the more I realize the collective intelligence of the world has gone down a significant amount. Like channel names that are a lie such as "no boilerplate" while demonstrating that this language still has plenty of it and in some cases more than C++. Or that the borrow checker is the greatest thing in the world because it prevents memory leaks while that only applies if the entirety of your code is written in the language, and even then it's still not assured, no matter what the designers guarantee. Of course that also neglects the fact that you have to use all kinds of extra machinery to be able to share data without forcing copies all over the place. Something which C++ doesn't suffer from because it has a simpler syntax here, and that sounds so strange and I'd never thought I'd say such a thing, but here we are. I keep hoping that humanity will grow up and get more intelligent, but the opposite seems to be happening, and Rust's rise to prominence is just another sign of the times.
1