[OT] OT: Null checks.

H. S. Teoh hsteoh at qfbox.info
Tue May 6 16:29:11 UTC 2025


On Tue, May 06, 2025 at 05:48:18PM +0200, Timon Gehr via Digitalmars-d wrote:
> On 5/6/25 08:11, Walter Bright wrote:
[...]
> > The reason is that `Error` means the program has entered an invalid
> > state. Nothing in the program can be trusted any more. The program
> > should do as little as possible to close down gracefully.  ...
> 
> "The patient has a light cough. The patient has thereby entered an
> invalid state. The doctors must now do as little as possible before
> they blow up the hospital in order to euthanize the patient and
> everyone else that may have been in contact with them."

That's not a very accurate analogy.  A closer analogy to a program
trying to fix itself would be a patient self-diagnosing and
self-medicating.  "I think I'm hyperventilating because I have type B
diabetes.  Let me take these pills and hope for the best."


> I want to diagnose and heal the patient!
[...]

Yes, but the patient can hardly be trusted to diagnose and heal himself.
In order for treatment to be reliable, the doctor, so to speak, must be
a separate, independent process that hasn't been compromised yet.


T

-- 
Answer: Because it breaks the logical sequence of discussion. / Question: Why is top posting bad?


More information about the Digitalmars-d mailing list