5 ms·
Have you tried C++? Rust is an alternative to C++ or C, not to Go, C# or Python. Sure, you can write any program on any language, but if you try to write bare
by fluffything 6y ago
Have you tried C++?
Rust is an alternative to C++ or C, not to Go, C# or Python.
Sure, you can write any program on any language, but if you try to write bare metal C code from C# or Python, your frustration will be quite large as well.
Use the right tool for the job.
- kumarvvr 6y agoI have used C++. I understand about using the right tool for the job. But Rust and Go are not good tools solely due to their syntax.
- dragonsh 6y agoJust a minor correction, Rust is trying to be replacement of C++. It will be unlikely to replace C, at least for next 2-3 decades. C will serve as the low level language and Rust will be a higher level language. Today Rust needs LLVM (written in C++), to generate binaries and it may be 2-3 decades before Rust will be used to write anything like LLVM with supporting platforms. Today Rust library to do anything useful rely on unsafe integration with underlying C code. Rust is still on fringes and quite a complicated language compared to C. I still doubt it will be a replacement for either, may be it will go-exist with C/C++ on fringes and may be in next 30 years if it survives like Python might have significant code and can be useful in place of C++.
- pjmlp 6y agoNo language will replace C on its turf, FOSS UNIX clones and embedded POSIX RTOS. Everywhere else C has been being replaced a good part of the last two decades, even all major C compilers are written in C++. As for Rust, yes a co-existence is more likely.
- jstimpfle 6y ago> Everywhere else C has been being replaced a good part of the last two decades, even all major C compilers are written in C++. You keep saying this, but I'd recommend you to look at a few random "C++" files in https://github.com/gcc-mirror/ https://github.com/gcc-mirror/ for example. For many of these projects, "moving to C++" often means to change the file extension. Or not even that, sometimes it's just changing the build setting to "Compile as C++". There's no reason for holy wars. Fact is that regular C code is still ruling the world. Maybe not in the financial industry. Maybe it's embedded in a few C++ syntactic constructs. Maybe some people even found a way to use RAII in a way that doesn't suck in a large project. But the vast majority of the stuff that does something is still dangerous, evil, ugly C. And now excuse me while I go watch another talk named "C++ Features to avoid" or "Taming build times in a large C++ codebase" or "Why we went back to plain C"
- pjmlp 6y agoYeah, the old USENET argument of comp.lang.c, kind of missed that. Here are my reading recommendations, https://gcc.gnu.org/wiki/gcc-in-cxx https://gcc.gnu.org/wiki/gcc-in-cxx "This page is meant to eventually help document the ongoing effort in the "gcc-in-cxx" branch to make gcc compile in C++ mode, i.e. as C++ source code. So, the goal of this branch is to facilitate switching GCC's implementation language to C++." https://devblogs.microsoft.com/cppblog/the-great-c-runtime-crt-refactoring/ https://devblogs.microsoft.com/cppblog/the-great-c-runtime-c... > "We have converted most of the CRT sources to compile as C++, enabling us to replace many ugly C idioms with simpler and more advanced C++ constructs." https://llvm.org/docs/Proposals/LLVMLibC.html https://llvm.org/docs/Proposals/LLVMLibC.html "Provide C symbols as specified by the standards, but take advantage and use C++ language facilities for the core implementation." You are excused, write a blog post afterwards.
- jstimpfle 6y agoThere is a fallacy in taking enterprises that might be done "eventually" as being already completed and ultimately proven. What you quote is not disagreeing with what I was saying at all. Quick look at the GCC link you posted: Project Status (last updated 06/2009) Phase 1 of gcc-in-cxx now complete (06/2009) gcc-in-cxx completes bootstrap as of 03/2009 Seriously. > "Provide C symbols as specified by the standards, but take advantage and use C++ language facilities for the core implementation." Sure, now let's look at the code https://github.com/llvm/llvm-project/blob/master/libc/src/ https://github.com/llvm/llvm-project/blob/master/libc/src/ Oh, it's not even a completed project. Here is stdio https://github.com/llvm/llvm-project/blob/master/libc/src/stdio https://github.com/llvm/llvm-project/blob/master/libc/src/st... stdio/ for example has just 3, mostly empty files: file.h, fwrite.cpp, fwrite.h. Last commit was 8 days ago. It's not a project to be taken as serious evidence for any argument. You need to stop selling things that might never exist, or have long been dead in the water. Apart from that, I've looked at 10 files and the only use of C++ I've seen was some namespacing (that just makes the code more verbose IMO; YMMV). It's essentially C, the thing you're leading a religious war against. In this day and age where it's common knowledge that we're all living in opinion reinforcement filter bubbles, it should be possible to expect from people to at least quickly skim the citations they provide.
- StreamBright 6y ago>> Rust will be a higher-level language. It does lots of low-level things that are closer to C though.
- zozbot234 6y agoRust can absolutely replace C in everything except small embedded platforms where only a C compiler is available. With the unsafe subset, it can do anything that C can do. It's actually harder to seamlessly replace C++, because C++ has its own semantics that are not very easily replicated in Rust.
- steveklabnik 6y ago> Rust is trying to be replacement of C++. Rust is not trying to replace any language. > it may be 2-3 decades before Rust will be used to write anything like LLVM with supporting platforms. Depending on what you mean by "like LLVM," this already exists partially in Cranelift. We'll see if it takes three decades or not.
- nicoburns 6y agoHopefully something like zig will replace C. Much less complex than Rust, but with niceties like modules and arrays.
- fluffything 6y ago> Rust is trying to be replacement of C++. Citation needed. Rust lacks so many fundamental C++ "features" (variadics, thin pointers, HKTs, const generics, specialization, overloading, inheritance, good FFI with C++, C++ exceptions, ...), that trying to sell it as a C++ replacement is quite hard. OTOH, Rust is pretty much at feature parity with C, having excellent interoperability with it, and only lacking somewhat in inline assembly, allocas/VLAs, etc. You can take any C project, and implement a new feature or refactor some part of it in Rust without issues. You can't do the same for C++ code easily: integrating with C++ templates is hard (e.g. try to use a C++ Boost library, or the C++ standard library from Rust), integrating with C++ error handling is hard (try to write Rust code that can error using C++ exceptions, or that can be unwinded with one), calling C++ ABIs is hard from Rust, interfacing C++ types with Rust is also hard (inheritance, virtual functions, etc.). Any successful C++ projects that uses Rust (e.g. Firefox), uses Rust as a better C to implement a C library, that can be called from C++. That's not "being a better C++" in any way of the word.