The solution to "Error handling"...

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Mon Jul 6 03:33:17 UTC 2026


On 06/07/2026 3:31 PM, Meta wrote:
> On Sunday, 5 July 2026 at 23:36:59 UTC, Walter Bright wrote:
>> Another term that describes his proposal is a "black hole object", 
>> which accepts all input but does nothing.
>>
>> The main thrust of his argument is eliminating the `if` statements 
>> that check for error states.
> 
> Ya... I don't agree with him at all on that. His approach to reducing 
> paths dedicated to error handling in his code is to ignore those errors 
> - which is what his "nil struct" solution does. I don't think it's a 
> good design at all. One thing that WOULD genuinely help reduce errors is 
> leveraging type system invariants to make certain invalid states 
> impossible - a great language-level solution is not having null pointers 
> - but he is explicitly against that in this article.

A major concern with this approach is you can end up doing work, and 
making a value appear to have valid data, but is actually invalid.

Now you have program corruption and that is a far worse scenario than 
just ya know doing literally anything else.



More information about the Digitalmars-d mailing list