4 ms·
Memory safety, build system, dependency management, the usual
by Inityx 5y ago
Memory safety, build system, dependency management, the usual
- adamnemecek 5y agoIt's just overall productivity.
- netr0ute 5y agoCan you define productivity?
- smoldesu 5y agoI can't speak for everyone, but I spent an unconscionable amount of time managing dependencies and libraries in C++. In Rust, it's the easiest part of my workflow.
- adamnemecek 5y agoYou can speak for everyone. C++ dependency management is just...I don't even know where to begin.
- dkersten 5y ago> You can speak for everyone. Not really. I only use header-only libraries and dependency management is a breeze for me. I check each library out as a git submodule into a third-party subdirectory in my project directory, point the includes path at it and off I go. When I want to upgrade, I pull the git tag/branch/commit I want and recompile. Its pretty simple.
- adamnemecek 5y agoI mean that's cool but you are definitely working against the language as opposed to having the language support you. Also this works nicely for self contained dependencies, and much less nicely for not self contained dependencies.
- dkersten 5y ago> you are definitely working against the language How so? > Also this works nicely for self contained dependencies, and much less nicely for not self contained dependencies. Doesn't matter. You said: "You can speak for everyone." which is simply not true, as I have outlined. You didn't say anything about not self contained dependencies or whatnot. The person you replied to said "I spent an unconscionable amount of time managing dependencies and libraries in C++" and I... well, don't. So clearly not everybody does.
- adamnemecek 5y agoRight, but not all problems can solved with header only frameworks.
- dkersten 5y agoI did use Bullet physics not too long ago, which most definitely isn't header-only, but the exact same approach worked there too. Git submodule, set include path. The only difference is that I also told my build tool to build its sources and package them into an .a archive, which I linked against. It was no trouble at all.
- dkersten 5y agoToo late to edit: yes, I know this doesn't work for everything and won't work for everyone, but its worked great for me, so my point is simply that your assertion that everyone has difficulties dealing with dependencies is false. Some people for sure do, but there are people, like me, who don't.
- netr0ute 5y agoWhat would be best is libraries that can be added with a one-liner of an include statement, then there's no more dependency management needed.
- pornel 5y agoFor example, I almost never need to use a debugger or Valgrind with Rust. Mysterious memory corruption just isn't a thing. Memory leaks are not a problem either (even though technically Rust doesn't claim to prevent all leaks, it does well enough in practice). Rust catches data races, use of non-thread-safe functions, and use-after-free problems across the entire codebase, including (mis)use of 3rd party libraries, at compile time. I can add `.par_iter()` to a loop, and if it compiles, I know it doesn't mangle any data. If it doesn't compile, the compiler points me to the exact struct that needs a refcount, or a mutex, or atomic. That saves me weeks of chasing heisenbugs. In debug builds it checks all integer arithmetic for overflow (no need to wrap types in custom class, works for dependencies too). This has saved my ass a few times. There's a pretty decent standard library, and a good number of quality dependencies that can be installed with a 1-liner. If I need to (de)serialize a struct from JSON, it's a couple of lines. I want to switch that to msgpack instead, 2-line change. I need that compressed? 2 lines again, plugs in easily, and supports serialize-and-compress without an intermediate buffer. Build system uses convention over configuration, so there's no artisanal "build script" to manage, or even an argument which build system sucks less. Dependency management and workspaces work well enough that it's practical to modularize projects into smaller libraries, and actually reuse them. Unit testing is built-in. Doxygen-like generator is also built-in, no config needed. Of course any language can do the same, but having zero friction removes excuses and really helps making people actually use these things.
- adamnemecek 5y agoIt's just such a step-up that it's not even comparable.