5 ms·
> Rust in core Linux would probably be a horrible idea, given all the complexities of the language. C is a very complex language as well. It's just that when y
by adwn 5y ago
> Rust in core Linux would probably be a horrible idea, given all the complexities of the language.
C is a very complex language as well. It's just that when you're not aware of all the complexities in Rust, the compiler will refuse to compile; in C, you'll get a security vulnerability or weird crashes at runtime. Yes, this is a generalization, but only slightly.
C is deceptively simple – its complexities are well hidden.
- bcrosby95 5y agoRust is complex, and C's complexity is hidden - if it weren't hidden, C would be less complex. But, does that in turn make C more complex? It definitely makes it less safe. But I don't know if it automatically makes it more complex.
- adwn 5y ago> C's complexity is hidden - if it weren't hidden, C would be less complex. If it weren't hidden, it would be a different language. Would that language be less complex? That depends on what that language would look like. > But, does that in turn make C more complex? More complex than what? I'm not saying that C is more or less complex than Rust – what I'm saying is that C is not simple – its considerable complexity isn't visible at first glance, but it's there.
- phendrenad2 5y ago> Yes, this is a generalization, but only slightly Sounds like a total hand-wave to me. Can you provide examples of "well hidden" complexities?
- pdimitar 5y agoManipulating pointers as numbers. And addressing arrays out of bounds.
- phendrenad2 5y agoManipulating pointers as numbers (using the ++ operator for instance) is actually really simple, but most people do a bad job of explaining it.
- pdimitar 5y agoYou are severely missing the point. Of course it's simple. Many things are simple on their face. Until one rainy day you're slightly distracted and make a mistake. Be honest with yourself: you NEVER made a mistake that made you facepalm sometime in the future? Not once inn your life? People just refuse to believe they can make mistakes. That's why those discussions are impossible to win; they are about personal maturity and not about programming prowess. On one side you have the people confidently saying their famous last words: "it's simple, you all dumb or something?" and on the other you have those that are like "I know I can screw up even if I'm the best ever so let me use a language that will catch part of my mistakes". But yeah, the latter group can never convince the former. You all just repeat the same things every time and always miss the forest for a single tree. Very frustrating.
- darthrupert 5y agoNo, it's not a complex language. Come on.
- gypsyharlot 5y agoThen why do the seasoned veteran C programmers keep introducing memory security vulnerabilities all the time? Some of the projects considered by many to be idiomatic C keep introducing terrible bugs... Sqlite, Redis, etc.
- pca006132 5y agoI don't think bugs are introduced due to the language being very complex, but the problem/solution being complex. To prevent (some of) these, you may need a more complex solution, like what Rust provides.
- adwn 5y agoWould you like to address the arguments in my post instead of going "Na-ah, you're wrong, I'm right"?
- darthrupert 5y agoI get your point, but I'm queamish on how far you stretch the definition of the word "complex". C has these problems because it's simple, i.e. it provides a rather thin abstraction layer over machine language. Rust's corresponding layer is much thicker due to its memory requirements and historical origins.
- adwn 5y ago> it provides a rather thin abstraction layer over machine language. No, it doesn't, and it hasn't for quite some time – not since C compilers started exploiting undefined behavior for optimization opportunities. It used to be that if you wrote a + b where a and b are int values, the compiler would emit an ADD instruction in assembly. This isn't necessarily true anymore, because compilers are allowed to assume that signed overflow doesn't happen, which makes writing correct overflow-detection so difficult and non-intuitive. Even worse, code which was working correctly for 20 years might start exhibiting subtle bugs from one day to the next, just because you've upgraded your compiler from version 9.4.2 to 9.4.3. Undefined behavior is one major reason why writing correct C code is complex and difficult in practice.