8 ms·
Cargo in terms of ease-of-use but not in terms of scale. You only get the packages that Meson (or the community?) has written build scripts for. By my count tha
by vlovich123 6y ago
Cargo in terms of ease-of-use but not in terms of scale. You only get the packages that Meson (or the community?) has written build scripts for. By my count that's ~144 packages [1]. That's nowhere near as pervasive as Cargo given that basically any Rust project published will use Cargo vs C/C++ that has a mix of CMake & autoconf (largely standard for OSS) & BUCK/Bazel for Facebook/Google-influenced (potentially multi-language) codebases. That's also not including all the IDE-specific or platform-specific workspaces (Visual Studio, Xcode, gradle NDK builds, etc).
It's a nice thought but you have to be confident every 3rd party project you use is one whose parallel build you'll maintain as it updates. That's the strength of Cargo - it's the way to write Rust code & the maintenance is done by upstream for everyone.
Additionally Cargo's strength isn't just it's packaging & publishing system. Having a single Rust compiler that everyone uses on all platforms is powerful. C++ might get there eventually with clang but the ecosystem of libraries will need to support that as a baseline. Currently there's too many compiler or platform-specific hacks that are done to regularize the environment a bit whereas Rust generally does all of that under the hood for you (i.e. try writing any cross-platform BSD socket code - it's a total shitshow that basically results in Winsock & all other POSIX OSes basically different net stacks). Rust also comes with a very deep standard library for I/O, path manipulation etc whereas the C++ equivalents for all of this are still surprisingly lacking even in C++20 (especially on the network side).
[1] Based on manually counting the packages listed here https://wrapdb.mesonbuild.com/ https://wrapdb.mesonbuild.com/
- rapsey 6y agoWhen using Rust libs you also have some faith that the lib will not have some sort of memory corruption and introduce instability to your app. This is why C/C++ can never have the Rust crate system, no matter how user friendly the package manager.
- identity0 6y ago?? You're telling me C++ devs don't use libraries?
- rapsey 6y agoTo the degree of Rust no.
- self_awareness 6y agoIt's probably because of the complication of adding a library dependency in C++. If the ecosystem would use a Cargo-like management, I think C++ would have as much libraries, eagerly used, as Rust.
- Cloudef 6y agoOne could leverage something like Arch PKGBUILDs or nix recipes to create C/C++ "package manager". C/C++ libraries aren't really hard, all you need is "root directory" with the common {/include,/lib} layout. For C you could even have binary libraries, but for C++ binary libraries are gonna be quite a problem, because there's no ABI compatiblity and even different compiler flags can cause ABI incompatibility.
- oblio 6y ago> One could One could, but no one has. That's the whole discussion, there are multiple partial implementations with limited adoption.
- Cloudef 6y agoMSYS2 actually has one based on pacman and PKGBUILDs. I remember unofficial vita SDK going similar route as well. Probably there's tons of similar solutions but not marketed well enough.
- oblio 6y agoThe marketing part is the hard part, ideas are a dime a dozen, unfortunately. These solutions need to be almost ubiquitous to be truly useful.
- simias 6y agoIf anything this argument would make more sense the other way around: Rust cares about memory safety a whole lot more than C++, so it should be more concerned about having insecure interfaces leaking through dependencies. C and C++ don't have bespoke build and module systems because it wasn't really a thing back when they were conceived, that's it. And bolting that stuff as an afterthought on top of existing, widely popular languages is extremely difficult.
- otabdeveloper4 6y agoHaving multiple compiler implementations is a strength, not a weakness. As long as Rust is not standardized and documented only by the implementation's code it will never be a serious language.
- aprdm 6y agoWhat is a serious language? Is being used in companies like Amazon to deliver runtimes used by a considerable % of the internet not serious?
- papaf 6y agoWhat is a serious language? I would call C a serious language. Its running your laptop, your phone, your car, the airplane you took on holiday, the fighter planes that protect your airspace, your washing machine, and if you are unfortunate enough to get seriously ill it will probably be running on the medical equipment that keeps you alive. One of the reasons it is serious is because it is standardized and multiple implementations exist.
- aprdm 6y agoI do wonder what other languages you consider serious apart from C. You could use similar examples for a lot of other languages, C isn't the only language used to keep our civilization alive. I did a fair bit of development in C, and developed hard real time systems in VHDL that did involve life & death, but, wouldn't call any language used in the industry generating value as a non serious language...
- papaf 6y agoI do wonder what other languages you consider serious apart from C. Off the top of my head I thought C++ and Ada. However, you mention VHDL which I agree with and somebody else pointed out Javascript which is also a good point. The Javascript example (along with C++) make the point that serious computer languages are not necessarily great languages. I would argue that Rust is not a serious language (at the moment [1]) because its still young, there is no specification and if anything happens to the one implementation it would be a disaster. Despite C being a null pointer minefield, if someone was to sue a developer the argument could be made that it is an industry standard. In the less likely event that a Rust program hurt somebody what are you going to say? [1] https://users.rust-lang.org/t/is-there-a-plan-to-get-a-formal-rust-language-specification-at-some-point/21622/8 https://users.rust-lang.org/t/is-there-a-plan-to-get-a-forma...
- papaf 6y agoRust also comes with a very deep standard library for I/O, path manipulation etc whereas the C++ equivalents for all of this are still surprisingly lacking even in C++20 (especially on the network side). I agree with this point and cross-platform development is painful in C and C++. However, one of the reasons people use C and C++ is because of platform specific development. It turns out the platforms themselves are written in C. For example, the "very deep standard library" for Rust can't do DNS TXT queries. On Linux, I run 'man res_query' [1] and get the documentation. Notice the Synopsis, that's C/C++ and the Linux specific code I write can use that. Rust can also call these functions but there is an impedance mismatch between the safe world of standard rust and the unsafe calls to the system -- I imagine that a crate is a available to ease the pain of the 'unsigned char *answer'. I am not making this comment to belittle Rust, I actually think it is a good and safe alternative to C++. However, there is decades of system development behind the C/C++ ecosystem and coming onto a C/C++ thread (about a package manager) and calling things a "shitshow" is not going to win people over. [1] https://man7.org/linux/man-pages/man3/res_query.3.html https://man7.org/linux/man-pages/man3/res_query.3.html
- bschwindHN 6y agoOne of the great things about Rust is you can write platform-specific code for each platform and then package it all up into one interface so anyone can trivially use it. They get the simplicity of one interface and the performance of platform-specific code. Though I haven't used it personally, it seems like the trust-dns project is one such example: https://github.com/bluejekyll/trust-dns https://github.com/bluejekyll/trust-dns
- platinumrad 6y agoYou can do that in literally any language.
- bschwindHN 6y agoYep, but Rust makes it very easy to package and distribute libraries with Cargo, while maintaining performance on the level of C. I was mostly replying to this: > However, one of the reasons people use C and C++ is because of platform specific development. It turns out the platforms themselves are written in C.
- einpoklum 6y ago> Having a single Rust compiler that everyone uses on all platforms is powerful. It's also quite problematic, in that this tends to create a lot of reliance on non-standardized compiler behavior and quirks. > C++ might get there eventually with clang I sure hope not! (and I appreciate clang). It's important and useful for there to be several compilers. Plus, if any compiler becomes the single standard one, then it definitely needs to be strongly "copyleft"ed, e.g. with a GNU GPL license. Otherwise agree with the problems you identified.
- ansible 6y ago> It's also quite problematic, in that this tends to create a lot of reliance on non-standardized compiler behavior and quirks. While that may be a problem in other communities, with Rust there is a general aversion to undefined behavior. It is my belief that there will be more community pressure to fix quirks and such, and not depend upon them in general.
- einpoklum 6y ago> with Rust there is a general aversion to undefined behavior. Ah, but it will be defined behavior - just implicitly defined.