4 ms·
I'm out of the loop, what is the huge fascination with Rust? I see people getting excited about normal sounding projects that are written in rust - is it the ne
by goblinux 6y ago
I'm out of the loop, what is the huge fascination with Rust? I see people getting excited about normal sounding projects that are written in rust - is it the new C? new python?
- swsieber 6y agoFor me personally: * It has the performance profile of C * A really good package manager * I don't have to worry about segfaults/runtime issues from manual memory management * I love the type system (yay expressive static types with pattern matching) * Also prevents data races and other things like iterator invalidation * Also, null safety, among other things leads to a lot fewer runtime issues I need to figure out
- __s 6y agoNew C since it's about zero cost abstractions (in the don't pay for what you don't use sense) It does this well, since at the same time I was able to write 10k lines of JS game code into 10k lines of Rust game code: https://www.reddit.com/r/rust/comments/k3jy5g/i_rewrote_10k_lines_of_js_into_rust_over_the_last/ https://www.reddit.com/r/rust/comments/k3jy5g/i_rewrote_10k_... Have since rewritten server from nodejs to Rust. There the line count grew. But async/await was splendid there, & serde made implementing the json server/client protocol straight forward
- mynameisash 6y agoOthers may give a better answer, but from my perspective -- a data engineer who started learning rust maybe 8-10 mo ago -- I find that I am enjoying Rust because: * It has algebraic data types, pattern matching, etc. - language features that just don't exist in most languages I've used. (I did play with F# for a bit and really loved its capabilities, but I've never had the occasion to get into F#, unfortunately.) Once I start using these features, I suddenly find that all these other languages are sorely lacking. * Its safety guarantees mean that I spend more time in the IDE fixing compiler errors and less time in the running exe finding my problem. I often find that when my program compiles, it is generally correct. This has given me a lot of confidence in the quality of my releases (borne out in actual production code, not just toy projects) * Speed of execution is (in my experience), better than an order of magnitude faster than in other languages for a similar implementation. YMMV, and there may be some of that New Relationship Energy here, but I can absolutely see why it's been on SO's most loved languages for five years in a row[0]. [0] https://insights.stackoverflow.com/survey/2020#technology-most-loved-dreaded-and-wanted-languages-loved https://insights.stackoverflow.com/survey/2020#technology-mo...
- netizen-9748 6y agoCloser to the new C
- zelphirkalt 6y agoThe thing people get excited about are guarantees you get when compiling your (hopefully well written) Rust code. A huge chunk of software we have today is built upon other software that is built upon other software that ... but that whole foundation is rather shaky and probably incorrect. Basically, if you want to express it that way: Everything is broken and we have played the wrapping game for far too long as a professional group. There will probably forever remain bugs in that gigantic mountain of code, that we rely on. People get excited about rewriting things in Rust to avoid a good chunk of the legacy code written in languages that are not memory save and that do have a lot of undefined behavior or allow for race conditions easily once you even as little as touch concurrency. People want to finally have a solid basis, which is proven to be correct in implementation. Rust goes a long way towards this goal, so people like it. I subscribe to some great projects' repositories and read the issues. These projects sometimes bring me great value and I am not saying they aren't useful. Usually however, non-trivial C++ or C (and other languages) projects have all the same kind of issues. People thinking every noun has to be a class and the standard paradigm of mutating everything everywhere, be it through setter or directly, then forgetting to update state at some point, where it was necessary. People sharing state across multiple threads and forgetting to acquire a lock or releasing it. Or in some other way building race conditions. People thinking they will be able to do manual memory management correctly and then having segfaults, which require long debugging sessions or a lot of experience to fix. Use after free bugs. Security issues resulting from such causes. This and all that kind of stuff, that a good type system should prevent you from doing. And that is where Rust delivers.
- serverholic 6y agoHere's a relevant statistic. Microsoft tracked all their security vulnerabilities over 10 years and found that 70% of them were caused by memory-related bugs.
- zelphirkalt 6y agoAre you sure it wasn't the Chromium project? I have this one in my mind: https://www.zdnet.com/article/chrome-70-of-all-security-bugs-are-memory-safety-issues/ https://www.zdnet.com/article/chrome-70-of-all-security-bugs... But then again it could be the same for other projects and just be a general thing that happens.
- protoman3000 6y agoBorrowchecker and lifetimes automatize a big chunk of verifying all the states my code can yield. Rust has many zero cost abstractions that make writing things easier. It’s super high level at the speed class of C - sometimes even faster given that libraries for common tasks are well programmed. With the high level abstractions the compiler may probably reason and optimize better?
- elihu 6y agoAside from being a generally well-designed modern language with good tooling, I think the most interesting thing about Rust is that it accomplishes something that I wouldn't have thought was even possible until Rust came along: they made a memory-safe language that doesn't use garbage collection. The end result is that if you want to write high performance code, you don't have to do it in a language that's difficult to use correctly.