7 ms·
Not GP, but what is the point of touching Rust at all then?
by hypeatei 2y ago
Not GP, but what is the point of touching Rust at all then?
- nicce 2y agoTo generate safer C?
- koakuma-chan 2y agoCompiling Rust to C doesn’t simplify interoperability. Either way you’ll be calling C functions. I assume compiling Rust to C is useful if you’re targeting some esoteric platform that Rust compiler doesn’t support.
- nickpsecurity 2y agoI'd like to write Rust, receive its safety benefits (esp borrow checker), compiler to equivalent C, and then use C's tooling on the result. Why use C's tooling? In verification, C has piles of static analyzers, dynamic analyzers, test generators (eg KLEE), code generators (eg for parsing), a prover (Frama-C), and a certified compiler. If using a subset of these, C code can be made more secure than Rust code with more effort. There's also many tools for debugging and maintenance made for C. I can also obfuscate by swapping out processor ISA's because C supports all of them. On the business end, they may be cheaper with lower watts. I also have more skilled people I can hire or contract to do any of the above. One source estimated 7 million C/C++ developers worldwide. There's also a ton of books, online articles, and example code for anything we need. Rust is very strong in that last area for a new language but C/C++ will maintain an advantage, esp for low-level programming. These are the reasons I'd use Rust if I wanted C or C++ for deployment. Likewise, I wish there was still a top-notch C++ to C compiler to get the same benefits I described with C's tooling.
- koakuma-chan 2y agoRust is much easier to learn due to C/C++ books all being paid (even cmake wants you to buy their book) whereas Rust documentation is free. I bet more and more people are choosing to learn Rust over C/C++ for this reason, and the number of C/C++ devs will be decreasing.
- cynical_german 2y agowhat a weird take to me... C has DECADES of high quality teaching material in form of books, university courses, plenty of which is freely available with a bit of searching. And, if we discount the fact that "buying" a book is such a big hurdle, even more high quality academic text books and papers to boost; anything from embedded on the weirdest platforms, basic parsing, writing compilers, language design, high performance computing, teaching of algorithms, data structures, distributed systems, whatever! edit: I even forgot to name operating system design plus game programming ; and of course accompanying libraries, compilers & build systems to cover all of those areas and use cases! edit2: networking, signal processing, automotive, learning about industry protocols and devices of any sort... if you explore computer science using C as your main language you are in the biggest candy store in the world with regards to what it is you want to learn about or do or implement...
- koakuma-chan 2y ago> anything from embedded on the weirdest platforms, basic parsing, writing compilers, language design, high performance computing, teaching of algorithms, data structures, distributed systems, whatever All that is language-agnostic and doesn’t necessarily have anything to do with C.
- cynical_german 2y agoYes, but there is material covering all of those aspects with implementations in C plus libraries plus ecosystem support! From teaching material to real world reference implementations to look at and modify and learn from. And C maps so directly to so many concepts; it's easy to pick up any of those topics with C; and it being so loose makes it even perfect to explore many of those areas to begin with, since very quickly you're not fighting the language to let you do things.
- koakuma-chan 2y agoPeople may learn from material that uses C for illustration purposes, but that won’t prompt them to write their own C. And don’t even mention ecosystem support in C/C++ where developers are notorious for reimplementing everything on their own because there is no package manager.
- uecker 2y agoI think we will get the same safety benefits of Rust in a version of C relatively soon.
- koakuma-chan 2y agoBorrow checker is not the only feature that makes Rust great though.
- uecker 2y agoYes, it also has many aspects I do not like about it. Let's not pretend everybody shares your enthusiasm for it.
- koakuma-chan 2y agoWhat aspects do you not like about Rust?
- uecker 2y agoToo much complexity, long build times, monomorphization, lack of stability / no standard, poor portability, supply chain issues, no dynamic linking, no proper standard, not enough different implementations, etc. It is a nice language though, but I do not prefer it over C.
- koakuma-chan 2y ago> long build times, monomorphization Monomorphization is what causes long build times, but it brings better performance than dynamic dispatch. > lack of stability There was another comment which also never elaborated on how Rust is not stable. > supply chain issues Not a language issue, you choose your dependencies. > no proper standard, not enough different implementations Is that a practical problem? > no dynamic linking There is.
- 2y ago