3 ms·
I guess one real benefit of rust is that it will encourage C++ to find way to be a bit more safer. cpp2/cppfront is one such initiative, and there are a few oth
by jokoon 3y ago
I guess one real benefit of rust is that it will encourage C++ to find way to be a bit more safer. cpp2/cppfront is one such initiative, and there are a few other programming practices that encourage safety.
But other than that, rust is just a "modern ADA", nothing more. It cannot easily get interfaced with existing UI API either. Having verifiable code is a niche thing, it is very important, but most programmers don't need it.
Not to mention that rust is generally more difficult to read than C, and a language will always fail to be largely adopted if its learning curve is too steep. At least in C++, you can write code that resembles C, so it's still approachable to beginners. Not in rust.
I wish rust was easier to learn and had a syntax closer to C, while retaining its secure features. It has too many weird specific features and syntax that are too alien. A big reason python is popular is because it retains this "C style" and is so easy to deal with. Rust is the opposite of that.
- Ygg2 3y agoAs someone coming from Java, that's untrue. C looks like language written by the ancient ones. Especial the combos of * and []. And it's full of tiny gotchas what is width of type char? What is UB? Why is it segfaulting and so on? Sure to C trained eye it looks normal, but to a Rust trained eye Rust looks normal.
- DerekL 3y agoDo you mean “Ada”, the programming language? It's not an acronym.
- jeroenhd 3y agoC is a terrible language for beginners. It's full of footguns and restricted in different ways because the compiler had to once fit in a kilobyte of RAM or whatever. C programmers who defend how easy it is to mess up programs written in the language often go with "well if you knew how to program C well you wouldn't run into this problem, so get good" from what I can tell. C++ does better in some ways, and much worse in others (i.e. the incredibly verbose language, the Turing complete templates, the documented standards that take years to be implemented by any real compiler). Both languages are excellent for their problem space, but terrible for beginners. Rust isn't verifiable code, the language is far from formally verified. Just one level down into the standard library you'll find tons of unsafe{} blocks and other performance related trickery that invalidates the idea of pure verification. It does verify more things, like ownership, that other languages like C++ ask you to do yourself (i.e. remember to use move() because the compiler won't tell you if you don't) but that's just a drop in the bucket of program verification. It also produces better programs, in my opinion; the logs of programs written in other native languages quickly end up full of failed assert()a and memory corruption related crashes still happen to me on a weekly basis. Rust programs have their flaws (for example, being completely unable to deal with memory exhaustion from a language perspective) but I see a lot fewer Rust crashes and bugged our programs than any other language in that space. I also reject the notion that Rust is hard to read than C. It's more verbose, for sure, but that same complexity is still present in all of those "simple" C programs. You can just use mut for every variable and reassign it, you don't need to do all those functional operations or shadowing that you see in many Rust code bases. You can't ignore Result or Option types like you can in C, but in C fork() can still fail regardless of whether you're forced to deal with it or not, integers are still cast regardless of explicit casting, and all of the hidden assumptions about structs, pointers, and lifetimes are still present, regardless of whether you write them down or not. C lacks the ability to express complexity you're supposed to know, but that makes it more difficult to read correctly, not easier. The biggest issue with Rust readability is the alternate syntax inside macros, but there are plenty of preprocessor statements that do very much the same thing. Microsoft had developed some very extensive frameworks that are completely strung together by preprocessor macros exactly because the language was too limited to do what they wanted (but they couldn't afford to invent a better language, yet). I don't think Python is C like at all. It's a scripting language without static typing so it can't really get too complex in the first place. Syntax wise, I'd group is closer to PowerShell than to C. Where it can, it does insert complexity (lambda functions, list/dict comprehensions, object oriented design) but it's relatively simple because you don't deal with memory allocation, pointers, or concurrency yourself. You may be interested in Zig. It seems to be to C what Rust is to C++. The language isn't completely finished yet, but it's getting there. It features many modern language features in a language that is very C-like, with a potential solution for the allocation problem built into the language standard.