Non-null objects, the Null Object pattern, and T.init

Ola Fosheim Grøstad" <ola.fosheim.grostad+dlang at gmail.com> Ola Fosheim Grøstad" <ola.fosheim.grostad+dlang at gmail.com>
Sat Jan 18 15:01:23 PST 2014


On Saturday, 18 January 2014 at 02:59:43 UTC, Walter Bright wrote:
> On 1/17/2014 6:42 PM, "Ola Fosheim Grøstad" 
> <ola.fosheim.grostad+dlang at gmail.com>" wrote:
>> But then you have to define "invalid state",
>
> An unexpected value is an invalid state.

It is only an invalid state for a subsystem, if your code is 
written to handle it, it can contain it and recover (or disable 
that subsystem). Assuming that you know that it unlikely to be 
caused by memory corruption.

The problem with being rigid on this definition is that most 
non-trivial programs are constantly in an invalid state and 
therefore should not be allowed to even start. Basically you 
should stop making DMD available, it contains bugs, it is 
constantly in an invalid state vs the published model. State is 
not only variables. State is code too. (e.g. state machine).

What is the essential difference between insisting on stopping a 
program with bugs and insisting on not starting a program with 
bugs? There is no difference.

Still, most companies ship software with known non-fatal bugs.


More information about the Digitalmars-d mailing list