6 ms·
I don’t think that a simpler language and a helpful compiler are mutually exclusive. In the article, the author even points out multiple examples where Go (a si
by catlifeonmars 5y ago
I don’t think that a simpler language and a helpful compiler are mutually exclusive. In the article, the author even points out multiple examples where Go (a simpler language, relative to Rust) could output more helpful error messages.
I assert it’s possible to have a simple language where it’s difficult to shoot yourself in the foot. C just happens to be a simple language where it’s exceedingly easy to shoot yourself in the foot.
- kaba0 5y ago> I assert it’s possible to have a simple language where it’s difficult to shoot yourself in the foot Zig would be one such example.
- sgt 5y agoSo why is Zig being dwarfed by Rust in this arena? Shouldn't Zig be more popular or is it still too small and immature?
- wyldfire 5y agoZig refers to itself with a version number < 1 and says that the language is not yet stable. That's going to filter the less adventurous crowd out right away. And that's probably ideal - zig can work out the kinks with the adventurous crowd and be better prepared for its post-1.0 life.
- rthomas6 5y agoI haven't used Zig, but my understanding is that Zig is more comparable to C, whereas Rust is more comparable to C++. Zig is a much smaller and simpler language, but Rust has more high level constructs and abstractions.
- sgt 5y agoI can't comment on either, but I do enjoy C and you can build relatively safe C programs using tools like Valgrind and static analysis. So unless you are building the next OpenSSL it could very well be worth sticking to C11.
- mamcx 5y ago> whereas Rust is more comparable to C++ That only in matter of complexity. If rust were actually comparable to C++ it will a major mess. Rust is actually a ML + C + Haskell-ish lang..
- sgt 5y agoAnd that's exactly why I am a bit worried about learning it. I am not looking for a language that is too theoretical, like Haskell.
- mamcx 5y ago> I am not looking for a language that is too theoretical, like Haskell. Rust is not "theoretical", but have some theory applied to great effect. The comparison to Haskell is more in the use functional idioms, algebraic types, pattern matching and bits here and there...
- programmer_dude 5y agoIt's a very practical language (more than C or C++). But it does have a challenging learning curve. Pay no attention to how the language was derived. Just dive into it.
- zozbot234 5y agoRust is built to be 100% memory safe, not just "hard to misuse in practice". Of course the claim comes with some provisos about how you're always relying on 'unsafe' code, but there is real value to it. Zig is interesting but doesn't have that USP.
- sgt 5y agoSo basically Zig is a toy, Rust is for serious stuff.
- catlifeonmars 5y agoThat’s an oversimplification. There are many reasons to choose one programming language over another. Strong guarantees of memory safety is only one design parameter.
- kaba0 5y agoIs C a toy? Zig just provides different guarantees.
- 10x-dev 5y agoIn my experience (and to generalize a bit), people who shoot themselves in the foot with C are the same people who will shoot themselves in the foot with any other language. Those who aren't careful enough to free up allocated memory are the same types of people who leak memory in Java. You can't fix lack of knowledge with a compiler. You can only catch accidental mistakes, but that assumes that the norm is for the person to know what they are doing and a lot of people have only superficial knowledge of the tools they are using. We already have accident catching tools for C. What C doesn't have is a helmet, training wheels and padded walls, which is by design.
- catlifeonmars 5y ago> You can't fix lack of knowledge with a compiler. The original article and the Rust language would beg to differ. The compiler generates detailed, didactic error messages with actionable suggestions.
- bluGill 5y agoNote that rust doesn't claim to catch all errors, and the article points out places where it doesn't. In rust it is a lot harder to get into those situations accidentally, but you can.
- cfcosta 5y agoMost of the incorrect code on the article for rust is quite contrived though. It's not perfect, just better, or more strict.
- bluGill 5y agoAny non contrived example would be thousands of lines of code. Rust is meant for those areas where you are forced to do weird things, it does it's best but they don't know how to solve the problem of what they need in a way that can't be misused. Seeing how contrived the examples are makes me more interested in rust.
- masklinn 5y agoElm is a good example of what you’re talking about, though it “cheats” a bit by being quite domain specific. Anyway it’s simultaneously a very simplified cousin of Haskell (similar syntax but most of the advanced syntactic and type stuff dropped), and where the current movement to make compiler error message more readable, conversational, and helpful (e.g. decoration, explaining the “reasoning”, providing possible solutions) originates.