4 ms·
I have a hard time believing that Rust's guarantees make it safer than easier statically typed languages like Java or Go. Rust is hard because it is solving a d
by guelo 9y ago
I have a hard time believing that Rust's guarantees make it safer than easier statically typed languages like Java or Go. Rust is hard because it is solving a different problem, memory management without a garbage collector, not because it has the strongest correctness guarantees.
- iopq 8y agoOf course it's safer. It prevents you from doing a null pointer exception. That just by itself is a big enough win not to even use Go or Java ever again.
- vvanders 9y agoWhat Rust gives you over Java is determinism. Having a GC doesn't preclude you from leaking resources(file handles, textures, etc) and you're at the mercy of whenever the finalizer decides to run once the GC has determined it's time to free an object. Usually this manifests as your Java application humming along until you hit some GC threshold cliff and then perf/memory plummets. I also can't enforce ownership in Java which drives me up the wall. Once you hand out a ref anything is fair game and calling code is free to add that ref to the root GC set so that it never gets freed.
- icebraining 9y agoRust doesn't have the Billion Dollar Mistake, as far as I can tell. That alone makes it safer than Java.
- pjmlp 9y agoEiffel was one of the first languages to fix it.
- dbaupp 9y ago... While your history comments can be interesting, not every comment about a feature of Rust needs a "rebuttal" about how it wasn't the first language with that feature. Especially not a comment that wasn't even mildly suggesting that Rust was the first language to not have null pointers/references! The comparison here was to "easier statically typed languages" (likely with an implicit "that one is likely to consider for a project these days"), with Go and Java explicitly raised for comparison. It's perfectly reasonable to respond to that with "There's no null", without explicitly acknowledging that there's also other languages (even ones before Rust) that don't have null.
- eeZah7Ux 9y ago> not every comment about a feature of Rust needs a "rebuttal" about how it wasn't the first language with that feature. People keep repeating that the popular language/framework/library of the year has $feature without acknowledging that it's not a new idea. This creates hype.
- dbaupp 9y agoI think my comment explicitly addressed why that general (and fair: I really hate credit-stealing) concern doesn't apply here.
- titanix2 9y agoEspecially since some byte-code languages such as OCaml or C# can be compiled to native code instead of targeting a VM, the number of cases where writing such manual memory by hand make sense doesn't seem very large.
- sushisource 9y ago"Having a hard time believing" isn't setting anyone up to care a whole lot about your comment - give it a shot and get some experience with it rather than pontificating.
- bbatha 9y agoRust doesn't have iterator invalidation issues or "ConcurrentAccessException" which are very nice for writing highly concurrent code at large scales. Throw in niceties like no null, result types for better error typing, and a culture of correctness and you've got a really nice language for writing correct software. Go and Java are certainly good at writing correct software too, especially compared to python or javascript, but don't offer anywhere near the same guarantees as rust. I would consider myself a Rust fanboy, but I wouldn't hesitate to use Go or Java in many domains, every tool has its niche.
- sixbrx 9y agoAgree and Rust's biggest benefit to me over most other languages, is being able to give ownership of a mutable structure away, and knowing at compile stage that every part of the program but the receiver loses access to make further modifications to that data. Then the receiver doesn't have to make a defensive copy (which is easy to forget and often hurts performance), or deal with immutable structures where they aren't performant or natural. I'm hoping some easier languages can add this ability - I think Swift might be planning to do some form of this IIRC, hoping to see some other languages follow.
- nicoburns 9y agoMy experience would disagree with this. Features like enums, traits and newtypes make it easy to encode a lot more of your programs invariants statically, and in ways which naturally fit the problem domain (as opposed to Java where I often feel like I'm trying to squash my structure into a class hierachy which it doesn't really fit). In addition the explicit error handling (together with enum error types) allow the compiler to check that you have handled every error case. Rust has enabled me to write programs that just don't contain bugs (after an initial testing period). This is certainly acheivable with other languages, but it involves a lot of discipline, writing tests, etc. Rust makes it easy.
- guelo 9y agoMaybe Java is a bad example. But there are plenty of languages that have similar features to what you mention that are a lot easier to learn.