3 ms·
It is good that rust is slowly being adopted everywhere. Gives me more reason to learn it..
by robertwt7 5y ago
It is good that rust is slowly being adopted everywhere. Gives me more reason to learn it..
- wiz21c 5y agoRust helps a lot with memory or concurrency issues. But not the rest. And in my experience, although the concurrency/memory issue are surely the most time consuming bugs, the "rest" is what takes 90% of the time...
- kortex 5y agoTo each their own. I find Rust a huge step up from C and even C++...especially C++. I've been writing Rust for months and C++ for years. I still feel more comfortable and confident my Rust code has fewer bugs and does what I intend vs C++.
- viraptor 5y agoThere's more that it helps with. For one example Rust's Enums and richer types allow fewer mistakes -vs- confusion where pointers and integers degrade to a common type. A random line: https://github.com/torvalds/linux/blob/122fa8c588316aacafe7e5a393bb3e875eaf5b25/include/crypto/aead.h#L283 https://github.com/torvalds/linux/blob/122fa8c588316aacafe7e... > void crypto_aead_clear_flags(struct crypto_aead *tfm, u32 flags) These are valid due to poor type usage, but make no sense: crypto_aead_clear_flags(..., PAGE_SIZE) crypto_aead_clear_flags(..., EBUSY) crypto_aead_clear_flags(..., SOME_RANDOM_THING) We can hope they would be caught in review if the code happens to do the right thing by accident, or use static analysis and hope it triggers in that case, or use a language with clearer types where it's much easier to use types preventing this issue.
- pjmlp 5y agoYou could the same with C++ or Ada, but naturally it will never be a thing in Linux.
- woodruffw 5y agoAda can do that, but C++ arguably makes things even worse than in C: apart from supporting a subset of C's misbehavior, it introduces implicit-by-default converting constructors. Those make API misuse very easy.
- pjmlp 5y agoExperience in Apple and Microsoft platforms, among others, shows otherwise. And for info, Android Treble drivers are mostly C++, although Java is also an option. Ah and Fuchsia is a mix of C++ and Rust at it lower layers.
- pjmlp 5y agoIt should be noted that memory in cases where automatic memory management cannot be afforded, and concurrency only in what concerns in memory data structures.
- _huayra_ 5y agoI would say that 90% of the bugs are just logic issues, but there is a heavy tail of devious bugs that will take 90% of the time, even if they don't surface right away. Although I still haven't really played around with Rust yet myself (still trying to grok the new C++20 features in recent weeks), the fact it puts your code into a (sometimes admittedly annoying) sandbox to prevent these bugs could be a godsend.
- scudd 5y agoIn general I find I'm productive in Rust; however, I do agree that there are some features that produce more confusion and debugging than others. For me it seems to be async and dynamic dispatch that are tricky.
- Zababa 5y agoCompared to plain C, you have ADTs which help from day to day programming. You can bring them to C (https://github.com/Hirrolot/datatype99 https://github.com/Hirrolot/datatype99) but I don't know if the Linux guys would allow it.
- cesarb 5y agoIn my opinion, you should learn Rust even if it doesn't get adopted everywhere. My experience is that learning the coding style enforced by the borrow checker (having to think about whether a piece of data is "owned" or "borrowed", whether it's an exclusive or shared borrow, whether it's safe to send or access it from another thread) makes you a better programmer in other languages.