|
|
|
|
|
by danbruc
3618 days ago
|
|
Maybe I (or you or both of us) have a wrong understanding of soundness. I understand it as follows - the specification of a programming language (or its implementation) is sound if the guarantees made a compile time hold at runtime for all inputs. The guarantee for calling a method on a reference in Java is that you either invoke that method or a NullPointerException gets thrown in case the reference is a null reference. After thinking about it again, unless you made an error in the specification or implementation, every programming language should actually be sound. You can always weaken your guarantees until they (trivially) hold at runtime. But that actually worries me a bit, soundness suddenly seems not such a useful concept. Maybe because I am wrong with my understanding? Note that this also possibly contradicts what I wrote previously, I may not have thought carefully enough about some of the things. |
|
That's technically correct. But it's like the joke about the mathematician who can only provide technically correct but otherwise totally useless answers.
> But that actually worries me a bit, soundness suddenly seems not such a useful concept.
Indeed, if you define soundness that way, it's a useless concept. That's why I refuse to accept a semantics that doesn't match how programmers actually think about their programs. I consider it undefined behavior to dereference a null pointer: the language implementor might trap the error to make debugging easier, purely out of goodness in his heart, but the program itself remains meaningless until it doesn't dereference null pointers anymore.
> Maybe because I am wrong with my understanding?
Nope, you're not wrong.