5 ms·
> In that sense, Rust enables escapism: When writing Rust, you get to solve lots of 'problems' - not real problems, mind you, but fun problems. This is a real
by Spivak 1y ago
> In that sense, Rust enables escapism: When writing Rust, you get to solve lots of 'problems' - not real problems, mind you, but fun problems.
This is a real problem across the entire industry, and Rust is a particularly egregious example because you get to justify playing with the fun stimulating puzzle machine because safety—you don't want unsafe code, do you? Meanwhile there's very little consideration to whether the level of rigidity is justified in the problem domain. And Rust isn't alone here, devs snort lines of TypeScript rather than do real work for weeks on end.
- hollerith 1y agoHave you tried to assure yourself that this or that piece of software (your primary text editor for example) doesn't need to be memory safe because it won't ever receive as input any data that might have been crafted by an attacker? In my experience, doing that is harder than satisfying the borrow checker.
- Spivak 1y agoYes, and you can choose to use any language with a garbage collector and get the same benefit. The list of memory safe languages at your disposal is endless and they come in every flavor you can imagine.
- airstrike 1y ago> Yes, and you can choose to use any language with a garbage collector Uh, no thanks. > and get the same benefit. Not quite.
- creata 1y agoThat's true (with some qualifications), but everyone seems to continue using C and C++ for everything, even for applications like text editors, where the performance of a GC language would presumably be good enough. I wonder why.
- nine_k 1y agoThe cost of it is spending more CPU and more RAM on the GC. Often it's the cost you don't mind paying; a ton of good software is written in Java, Kotlin, TS/JS, OCaml, etc. Sometimes you can't afford that though, from web browsers to MCUs to hardware drivers to HFT.
- ok123456 1y agoTypescript has escape hatches so you can just say "I don't care, or don't know." With Rust, you're battling a compiler that has a very restrictive model, that you can't shut up. You will end up performing major refactors to implement what seem like trivial additions.
- aapoalas 1y agoYou can always use `Box<dyn Any>` to get the same result in Rust :)
- bryanlarsen 1y agoOr use clone everywhere. I am not ashamed of having lots of clones everywhere outside of inner loops.
- ok123456 1y agoIt's not the same because putting it in a box semantically changes the program, adds a level of indirection. It's not just telling it to go away.
- ameliaquining 1y agoThere's no avoiding that in a language that's designed to offer low-level control of runtime behavior, regardless of whether it's memory-safe or not. You have to tell the compiler something about how you want the data to be laid out in memory; otherwise it wouldn't know what code to generate. If you don't want to do that, use an interpreted language that doesn't expose those details.
- deleted 1y ago[deleted]