4 ms·
In which way is that incorrect? How can you, when reading Python code, know whether it may error? Or is your point that Rust code can panic too, without it bei
by jakobnissen 4y ago
In which way is that incorrect? How can you, when reading Python code, know whether it may error?
Or is your point that Rust code can panic too, without it being clear from reading the code?
- WesolyKubeczek 4y agoExcept for the maybe simplest variable initialization, I always assume that if it exists, it may error. “Won’t error ever” doesn’t exist in the real physical world. (See also: halting problem.) The “invisibility” of errors in languages that have first-class exceptions usually means that exceptions are being somehow swallowed without being handled properly. Shit happens, and the program happily chugs along regardless, sowing destruction. If you get down to reading the code, you can usually see if it is likely to error out or not. At the point where you get down to reading the code, it’s usually quite clear unless intentionally obfuscated. A better question is, can a machine show you if the code may error and how, given language X? In statically compiled languages, IDEs have been wickedly good at inferring the possible exception types on any line of code for the last decade, even if you don’t annotate them in the signature.
- marcosdumay 4y ago> See also: halting problem. The one that can be solved for the overwhelming majority of code people write on real life?