[OT] OT: Null checks.

Timon Gehr timon.gehr at gmx.ch
Tue May 6 20:25:09 UTC 2025


On 5/6/25 19:39, Derek Fawcus wrote:
> On Tuesday, 6 May 2025 at 17:02:25 UTC, Timon Gehr wrote:
>>>> I want to diagnose and heal the patient!
>>> [...]
>>
>> I am the doctor. The information I have to go on now is "the patient 
>> is unwell sometimes".
> 
> Except you don't actually want to heal the patient.
> 
> You want to shoot that patient in the head after you've figured out how 
> to (shades of Dr. Frankenstein) build a "new improved" worker to ship 
> off to your customer.
> 
> (Or more accurately you send the new worker together with a single shot 
> revolver, pick ake and shovel, the customer is supposed to kill and bury 
> the old patient!)
> 

Well, the precise thing that is worth saving and fixing in this instance 
is the abstract state of the program. It can then often even live on 
after a code transplant, for the particular application I wrote in this 
case.

Anyway, at some point any analogy between a person and a program state 
has to break down, but I think it goes a long way to illustrate that 
assuming the worst at the first sign of trouble and going berserk to 
destroy anything of value that might have remained is not appropriate in 
most circumstances. Why even run a program at that point, the entire 
stack it runs on is already known to have bugs. x)


More information about the Digitalmars-d mailing list