3 ms·
Uh, no. Rust crates are still full of the type of bugs that Python libraries killed years ago. Garbage collection overall really does make things easier. And
by bsder 7y ago
Uh, no.
Rust crates are still full of the type of bugs that Python libraries killed years ago. Garbage collection overall really does make things easier. And Java still does concurrency better than practically everything else out there.
If you are doing systems programming, go for Rust instead of C++. Maybe even Rust instead of C. But, I would reach for Python, Ruby, Kotlin, Clojure or even modern Java before Rust for most non-Javascript projects.
- j88439h84 7y agoI'm not familiar with Java's concurrency. In Python I'm excited about the idea of "structured concurrency", embraced by its wonderful Trio library. https://trio.readthedocs.io https://trio.readthedocs.io
- bsder 7y agojava.util.concurrent is sheer utter brilliance condensed to code. If you're doing concurrency, you should look at how java.util.concurrent does it. And, then, if you aren't doing it that way, you should start asking really hard questions.
- rixed 7y agoSuch a strong wording lead me to check this library doc but I couldn't find anything in there unexpected or that looked particularly original, but only classical message queues, semaphores, futures and locks. Could it be that I looked at the wrong thing? Could you be more specific about what triggered such an enthusiastic description?
- bsder 7y agoReference here: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/package-summary.html https://docs.oracle.com/javase/8/docs/api/java/util/concurre... Take a good look at things like ConcurrentLinkedDeque or ConcurrentSkipListSet and then look at what guarantees they do and do not make and think about the rationale behind those decisions. And all you have to do in java is create the collection, hand the reference to multiple threads, and IT JUST WORKS like a normal Java collection. You do NOT want to be using semaphores and locks directly if you have java.util.concurrent at your disposal. Look at the "Concurrent Collections" section: Most concurrent Collection implementations (including most Queues) also differ from the usual java.util conventions in that their Iterators and Spliterators provide weakly consistent rather than fast-fail traversal: they may proceed concurrently with other operations they will never throw ConcurrentModificationException they are guaranteed to traverse elements as they existed upon construction exactly once, and may (but are not guaranteed to) reflect any modifications subsequent to construction. These are remarkably difficult properties to get correct. Then you have to think about fairness vs progress (the java.util.concurrent folks have thought about this a LOT). That library is something I sorely miss when I'm operating in another language. You should also dive into the code itself. Sometimes you'll look at a function and marvel at how much work it really takes to get something right. And sometimes you'll look at a function and wonder how it could possibly be so simple.
- rixed 7y agoI will have to look at the implementation some day, but I think I am starting to see what you mean with the API. Is the typical implementation of those days structures relying on many small scale mutexes to avoid contention, or RCU techniques ?
- bsder 7y agoMostly compare-and-swap mechanisms at critical points so that everything is always consistent (for very specific definitions of consistent). I think there are alternative paths when contention starts becoming too high. It's been a while, but the code is the real reference. You can go back and look at the mailing list archives as well. http://cs.oswego.edu/mailman/listinfo/concurrency-interest http://cs.oswego.edu/mailman/listinfo/concurrency-interest
- wcdolphin 7y agoYou’ll like Kotlin’s concurrency model then! It not only allows concurrency, but also parallelism, with rich language support. It is really pretty great, check it out!
- viraptor 7y ago> Rust crates are still full of the type of bugs that Python libraries killed years ago. That's an interesting claim. What do you mean specifically?
- bsder 7y agoWhenever I pull a crate, I invariably have to file a bug because I don't have the exact OS, OS version, Rust version, and crate version that the author develops on. I rarely file bugs on Python packages no matter how obscure my setup is.
- viraptor 7y agoIs that just a forward compatibility only? As in you're trying to compile on stable what is only available on nightly? Or are there actual backwards compatibility issues?
- bsder 7y agoMostly it's OS combos: Package X has issues on the latest Windows 10. Package Y runs on Ubuntu but not RedHat and fails on the latest release of Debian but not the prior one. Package Z crashes on OS X any older than yesterday. Now that Rust stable is actually reasonably solid, I just ignore crates that demand nightly.
- pjmlp 7y agoAgreed, any strong typed AOT/JIT compiled language should do the job. As for systems programming, I would argue that Rust still isn't an alternative to C++ in several deployment scenarios that many of us care about, although it should eventually get there.