5 ms·
There are even languages without garbage collection that makes a lot of things easier than they are in C. See Ada, Rust, ~~Go~~ D and others.
by kqr 11y ago
There are even languages without garbage collection that makes a lot of things easier than they are in C. See Ada, Rust, ~~Go~~ D and others.
- TheCoelacanth 11y agoGo is garbage collected.
- kqr 11y agoWhoops, sorry. I meant D rather than Go, but I guess that is also sorta-kinda garbage collected.
- unscaled 11y agoD is also primarily garbage collected. You had an option to create scoped classes (allocated on stack) but it's apparently deprecated now. I think Swift would be a better example here. Or objective C with ARC.
- rhodysurf 11y agoRust is great, but I think C is much easier
- catnaroek 11y agoYou mean it's easier to write an incorrect program in C than a correct one in Rust? Of course! If you mean it's easier to write correct programs in C than correct programs in Rust, I'm afraid you're badly mistaken.
- bpicolo 11y agoI mean, Rust has a lot of high-level features that make it flat out easier once you get past fighting with the compiler...
- catnaroek 11y ago> once you get past fighting the compiler Actually, it's the very process of “fighting the compiler” (as you call it, though I prefer to view it as collaboration between a human who knows what he wants and a program whose logic codifies what is possible) that makes it easier to write correct programs in Rust/Haskell/ML/$FAVORITE_TYPEFUL_LANGUAGE.
- dllthomas 11y agoI think there's a time before you learn how to make that collaboration productive, for a given tool, which is more aptly termed "fighting" and which you should certainly be able to get past. After that, you can have disagreements but they are far more productive.
- catnaroek 11y agoFrom what I have seen, only the hacker types find themselves “fighting” against (executable embodiments of formal) logic.
- dllthomas 11y agoThis seems an unwarranted dig against a poorly specified group of people. The notion that a type system is "just" logic and so should be trivially followed by anyone "smart enough" or "careful enough" is laughable - there are many different type systems (sometimes with different details depending on the options or pragmas you feed to your tooling), and it can take time to get a sense of where the boundaries are. The notion that you're not likely to find a type system helpful if you have trouble with it initially is harmful. Quit it with the self-congratulatory masturbation.
- deleted 11y ago[deleted]
- dllthomas 11y agoThis seems an unwarranted dig against a poorly specified group of people. The notion that a type system is "just" logic and so should be trivially followed by anyone "smart enough" or "careful enough" is laughable - there are many different type systems (sometimes with different details depending on the options or pragmas you feed to your tooling), and it can take time to get a sense of where the boundaries are. The notion that you're not likely to find a type system helpful if you have trouble with it initially is harmful. Please don't do this.
- bpicolo 11y agoI mean, Rust has a lot of high-level features that make it flat out easier once you get past fighting with the compiler...
- wyldfire 11y agoThat is some really good perspective. The incorrect C program is a bit of an externality that's felt by QA/testing/customers/etc. I liken programming w/Rust to programming with C or C++ with warnings and a static analyzer barring object files from being created. If I were new to C/C++, I would probably find it baffling how anyone ever gets it to work.
- rhodysurf 11y agoC is a much simpler language thats all. I understand its easier to write safe program in Rust. But to just pick up a language and go, C is easier in my mind.
- catnaroek 11y ago> C is a much simpler language thats all. Simpler in what sense? Not this one: https://news.ycombinator.com/item?id=10671800 https://news.ycombinator.com/item?id=10671800
- Manishearth 11y agoIt's deceptively simple. It's probably easier to write CS101 prime-number or fibonacci programs in C. Any nontrivial bit of software? You're going to have to learn about undefined behavior and deal with it. Rust forces you to learn this before getting started. Plus Rust has a lot of higher-level (still zero cost) abstractions like Python which make a lot of patterns really easy to program. (And Python is _the_ teaching language these days) See also: https://www.reddit.com/r/rust/comments/3mtwev/using_rust_with_ruby_a_two_hour_deep_dive_with/ https://www.reddit.com/r/rust/comments/3mtwev/using_rust_wit...
- whyever 11y agoWhile I agree with your sentiment, I think this is not true in general. The Rust compiler sometimes rejects correct programs, in which case it can be harder to write it in Rust than in C.
- catnaroek 11y agoIn the absolute worst case, you can pretty much transcribe your C program into unsafe Rust, though you will be fighting the syntax, which was deliberately made cumbersome to discourage programmers from writing unsafe code. In practice, I have never seen any programs where this is the best approach. Coming up with designs that don't need unsafe code is very useful, because the safe subset of Rust is vastly easier to analyze and understand, both for humans and computers.
- pcwalton 11y ago> The Rust compiler sometimes rejects correct programs, in which case it can be harder to write it in Rust than in C. Well, the C compiler sometimes rejects correct programs too.
- crzwdjk 11y agoSometimes C compilers can't even agree on what counts as "correct"! With Rust, you can at least be reasonably sure that if your program compiles with your version of the compiler, it will continue to do so with all later versions, because they're coming from the same codebase and made by people who care about backward compatibility.
- catnaroek 11y ago> Sometimes C compilers can't even agree on what counts as "correct"! This comes primarily from the fact the C standard itself is hard to interpret right. Standard ML has less issues in this department: since the Definition is clearer and less ambiguous, implementations disagree less on what counts as correct code and what its meaning is. So having only one major language implementation isn't the only way to prevent compatibility issues.
- VeilEm 11y agoComing from JavaScript, Java and Python, Rust has a steep learning curve, but with thought and patience you can learn to write Rust. I am getting much better at thinking about ownership before even compiling now. If some silly webdev like me can hack it, other programmers can do it too.
- ansgri 11y agoThere are even languages with deterministic destruction which solves nearly all resource leak problems, and at least one of them is directly compatible with C and has nice metaprogramming facilities. C++ it is.