4 ms·
Rust is approximately a 0.5 language. It takes longer to write but results in more reliable code.
by zik 6y ago
Rust is approximately a 0.5 language. It takes longer to write but results in more reliable code.
- hasperdi 6y ago“...more reliable code” citation needed
- AstralStorm 6y agoCompared to what? Java with its verbosity and relative lack of language features, partly hidden by powerful but complex libraries? (Partly shared by more potent C#.) C++ which is only slightly faster to write safely than Rust, you have to be careful to not use unsafe subset, and generic code is more verbose? C which has even fewer language features than Java and is harder to make safe than C++? Javascript where it is easy to write bugs, mostly of the null object kind, and hard to handle exceptional situations? With mediocre debuggers? (Also thus used with complex frameworks and libraries.) Python or Ruby, where instead performance may require dirty tricks using extra time? Perl? PHP? (Do these even have well working debuggers?) (Last 5 require additional code for tests due to dynamic nature to ensure correctness too.) Lisp, Haskell, SML or OCaml where there are fewer quality resources and libraries available to programmers? Perhaps the less used JVM/CLR or JS languages? (Groovy, Kotlin, CoffeeScript, F# come to mind.)
- samatman 6y agoC is much faster to write than Rust. It's the subsequent debugging that gets ya.
- perryizgr8 6y agoI find this sort of comparisons dubious. For me, who's a total rust noob, C is 10x faster than rust, because I need to keep looking up rust syntax for basic things like for loop. If I ever learn rust as well as I know C, I'm sure my speed won't be any faster or slower. For me, the time to think up a solution is the major chunk, writing it out seems to be nothing in comparison. So why would the language affect that in a meaningful way? Now, the one way rust can really give you time savings is the lack of entire classes of bugs. I spend 90% of my time fixing bugs in the code my coworkers and I have written over the past year. And most of them are really subtle memory and thread safety problems that are difficult to track down. If rust can eliminate that, I am willing to spend a year getting comfortable with the language.
- AstralStorm 6y agoI agree, if you're learning a language you will be slower with it. I wrote this from a perspective of having used them for a reasonable time, and I used most of the above fluently, except C#, Ruby, Perl, functional bunch, which I've only used for small side projects. (And I have not mentioned Fortran which we also used a bit, Borland Pascal, Object Pascal AKA Delphi, Visual Basic, C64 Basic, QBasic, x86 and ARM assembly.) I also know and are fluent in much weirder, atypical languages, almost esolang, of CRM114 and Faust, and rare ones like Nemerle and Vala. Rust is pretty pedestrian compared to some of these, rather powerful and generally nice. Writing in Rust feels like writing in a cross of C# and C++20 (less verbose) with a sprinkling of SML/OCaml inspired syntax. Main slowdown I got was having to write some foreign function interfaces, but it was as nice at it as Python with Cython, nicer than say Vala or Haskell. Much nicer than Java FFI - JNI. Also the common build and package system Cargo was a bit different from what I'm used to, but not altogether bad.
- pkolaczk 6y agoQuite debatable. Yes, there are moments when I'm getting stuck for a long time, but I'm still learning. Java was definitely simpler to learn. But on the other hand Rust makes writing convoluted code almost impossible. I don't see reference hell like I often see in Java programs. Making dependency cycles and global state so hard is IMHO a big win in bigger projects.
- SomeoneFromCA 6y agoIt is certainly verry slow to compile, almost unbearable.
- CryZe 6y agoThat does not seem true at all. The only two things that slow you down is: 1. The compile times. But those are comparable to C++. 2. The borrow checker and ownership rules. But you get used to those rules and eventually they are ingrained far enough into your brain that you barely run into problems with them anymore. However one thing that is overlooked entirely here is that writing code doesn't just mean writing code, but also running and testing it, which due to the increased reliability are shorter if not even greatly shorter than most other languages. So especially compared to C and C++ you end up writing code a lot faster.