3 ms·
Is it because the types and memory issues have been sorted out during the compile phase meaning code will "run" without crashing? That doesn't mean the code wi
by bb88 2y ago
Is it because the types and memory issues have been sorted out during the compile phase meaning code will "run" without crashing? That doesn't mean the code will work (infinite loops, etc), but it will run, right?
I've seen more than one Java program that will compile, but will throw a NullPointerError that gets unhandled.
- rapsey 2y agoYes. Quite often you spend hours working on something and when you run it the first time it just works. This is one of the major reasons people fall in love with Rust. There are just very ugly surprises or runtime issues. If it compiles it runs.
- bb88 2y agoCompilation != Correct unless you're Ada spark with probably correct software. Though it is interesting that a lot of the frustration I had with C++ in my younger years were crashes for unknown reasons.
- the__alchemist 2y agoCertain classes of errors will not appear during runtime if a rust program compiles. This is not the same as saying the program will run correctly. Can you see why?
- __david__ 2y agoOf course you’re technically right (you can absolutely write buggy code with Rust) but what others are saying (and what I have also anecdotally observed) is that Rust seems to have a much higher probability of new code just working (bug free) once you’ve cleared the compile step. The only language I’ve used that worked like that was ocaml and maybe Haskell (though I only dabbled in that).
- rapsey 2y agoIt was quite obvious I was speaking anecdotally.