[RFC] Throwing an exception with null pointers

Derek Fawcus dfawcus+dlang at employees.org
Mon Apr 14 15:42:07 UTC 2025


On Monday, 14 April 2025 at 15:24:37 UTC, Richard (Rikki) Andrew 
Cattermole wrote:
>
> It is important to note that a task isn't always a process. But 
> once an event like null dereference occurs that task must die.

It is not the dereference which is the issue, that is the 
downstream symptom of an earlier problem.  If that reference is 
never supposed to be null, then the program is already in a non 
deterministic even without the crash.

The crash is what allows that bad state to be fixed.  Simply 
limping along (aoiding the deref) is sweeping the issue under the 
rug.  One doesn't know what else within the complete system is at 
fault.

The @safe annotation is not yet sufficient to ensure that the 
rest of the system is in a valid state.

Fail fast, and design the complete architecture with redundant HA 
instance can take the (or a sub-set of the) load until the system 
can regain its redundant operating condition.That is exactly what 
we do with routers.


More information about the Digitalmars-d mailing list