4 ms·
What's the weak points (except not-very-easy-to-learn and complication speed) of Rust? It listens perfect in every other aspect from the Rust promotion articles
by tapirl 6y ago
What's the weak points (except not-very-easy-to-learn and complication speed) of Rust? It listens perfect in every other aspect from the Rust promotion articles.
- MaulingMonkey 6y agoIDE tooling / intellisense is improving but still weak compared to, say, C# IME - although I should maybe give IntelliJ another shot. It's still got a lot of low level building blocks in place but there are still gaps and mid-tier / high level frameworks are still missing for many problem domains. It's strictness, while generally useful in the long run, can be more of a drag than a boon for quick and dirty projects (although the more I use it, the faster I'm getting with dealing with said strictness...) It's got a nice hefty stdlib, which is usually a boon, but can be annoying to port for weird platforms. There's almost always a working C++ environment available, but Rust takes more work. A concrete example: https://github.com/MaulingMonkey/rust-opendingux-test https://github.com/MaulingMonkey/rust-opendingux-test . And yes, that "Rust" repository does have 2 lines of C code in it ;). EDIT: Also, no standard/stable Rust ABI. And extremely limited dynamic runtime reflection via "dyn Any" (although pretty decent hygenic macros / proc macros and related crates makes the compile time stuff sufficient for most of my day to day needs). Still, C# DLL reflection is super nice at times, whereas Rust is "forced" to ship source code for libraries unless they want to jump through a bunch of hoops to limit the API surface to the C ABI... EDIT: Also, a lot of rust libraries are quick to adopt new features of the latest stable compiler. Tools like rustup make it trivial to stay on the latest stable compiler, but can make things awkward if you insist on apt-provided rustc, or if you need to customize the compiler or stdlib for your particularly oddball target platform (read: consoles, but not opendingux like I linked above) - this can be a pain point.
- orthoxerox 6y ago> Its strictness, while generally useful in the long run, can be more of a drag than a boon for quick and dirty projects (although the more I use it, the faster I'm getting with dealing with said strictness...) I wish cargo/rustc had a "I don't care about borrow checks right now, just don't reclaim any memory, I want to make sure my code does what I want first". Maybe I don't have enough experience writing Rust, but I don't enjoy switching from thinking about domain logic to thinking about memory management every time I want to run a unit test.
- unrealhoang 6y agoThere’s `Box::leak` that you can use to turn your object into a static pointer.
- perryizgr8 6y ago> I wish cargo/rustc had a "I don't care about borrow checks right now, just don't reclaim any memory, I want to make sure my code does what I want first". That's exactly what C is. The truth is you need to be always thinking of memory. If you care so much about the domain problem, you should choose a different language. Python and javascript are both very good at letting you grapple with your problem, without worrying about the computer. Once you have solved it, and need a performant implementation, come back and write it in rust. And this time you need to be worrying about memory. C lets you ignore that and that's what rust was designed to prevent.
- MaulingMonkey 6y agoRc<RefCell<...>> / Arc<Mutex<...>> and borrowing or locking for micro-scopes, only exactly when you need the inner values, will get you pretty far when you're looking to turn off your brain. Sometimes they're even the correct choice! It's not entirely frictionless, but it can get pretty smooth. Cell / Atomic* can be nice too.
- umanwizard 6y ago> I wish cargo/rustc had a "I don't care about borrow checks right now, just don't reclaim any memory, I want to make sure my code does what I want first". This couldn’t work because running destructors is sometimes required for actual correctness, not just reclaiming memory. (E.g., you might have a type that writes some records to a file and flushes the outstanding records in memory to disk when dropped)
- moldavi 6y agoRust fits well in low-level cases and data-oriented design situations. For things needing any abstraction or modern OO, the borrow checker really damages your architecture.
- Ar-Curunir 6y agoRust does abstraction very well with Traits. Abstraction != OOP.
- 1tCKV3QfIo 6y agoIt still pales in comparison to OCaml, Haskell, etc for composing abstractions without OOP.
- moldavi 6y agoNot from what I've seen, and idiomatic Rust (to my frustration) advises against traits in favor of enums, probably because they dont do well in Rust. Also, I didnt claim abstraction == OO, but Rust struggles with both. Luckily, Rust shines in cases where no abstraction is needed.
- Ar-Curunir 6y agoIdiomatic Rust does not advise against traits. The standard library makes extensive use of them, and most libraries in the space do that as well.
- steveklabnik 6y agoI think you're talking about trait objects, not traits entirely, right?
- umanwizard 6y agoAll rust code I have seen uses a massive amount of traits. I second the other comments saying you must be confused about something.
- higerordermap 6y agoYou have to think about memory management. No matter what rust evangelists say, you have to think about it. Well you don't have to worry about it like in C. Of course rust is intended for safe performance-critical programming. GC is fine for a significant portion of software. The ruby / javascript webshit culture creeping in - lot of microdependencies which can often be hard to audit. Projects like cargo-crev aren't getting any traction. Crates.io - the package registry lacks namespacing. That means package names have to be choosen carefully and you might here phrases like "import data from cabbage to rabbit using chickenshit crate" etc.. Async runtime fragmentation because stdlib doesn't provide one. Very small standard library. Many things need you install a crate which might come with 40 other dependencies. This kind of dependency counts are fine for creating webshit but sometimes you need to audit your dependencies, especially rust is intended for low level programming. Horrible compile times. You might think rust has better compile times than C++ because it has a module system. But compile times are similar. Rustc emits large chunks of LLVM IR. Not faulting people working on rust for this - but they have a shortage of talent. And rust community's zealotry makes lot of people sceptical. A very zealot community which also happens to be very active on programming link aggregators. You might get downvoted irrationally for simply critisizing some flaw of rust. You keep on hearing zero-information / out of context statements heralding rust. This is partly a consequence of influx of people from blogging-heavy ruby and javascript communities. Especially the javascript crowd has an Instagram feel to it. Some people among these have marginal knowledge of computer science concepts and still show up everywhere heralding rust. No structural typing. This may be flaw or virtue - people from dynamic typed languages may like structural typing as in Go or OCaml than nominal typing.
- Aeolun 6y agoI cannot wrap my head around the uses of structural typing. Unless I tell something to be a certain type I expect it not to be.
- higerordermap 6y agoWell it is subjective. That's why I wrote it may be good or bad. But those from dynamic typing backgrounds may find structural typing more natural. I don't bother as long as there is a way to implement an interface without lot of subclassing boilerplate.