Program logic bugs vs input/environmental errors

Brad Roberts via Digitalmars-d digitalmars-d at puremagic.com
Fri Oct 3 19:25:53 PDT 2014


On 10/3/2014 6:52 PM, ketmar via Digitalmars-d wrote:
> On Sun, 28 Sep 2014 17:09:57 -0700
> Walter Bright via Digitalmars-d <digitalmars-d at puremagic.com> wrote:
>
>> If the program has entered an unknown state, its behavior from then
>> on cannot be predictable.
> and D compiler itself contradicts this principle. why it tries to
> "recover" from parsing/compiling errors? it should stop on the first
> encountered error and not trying to "recover" itself from unknown state.
> hate this. and it's inconsistent with your words.

Where's the contradiction?  The compilers state hasn't been corrupted 
just because it encounters errors in the text file.  In fact, it's 
explicitly built to detect and handle them.  There's not even a 
contradiction in making assumptions about what that input could have 
been and attempting to continue based on those assumptions.  At no time 
in there is the compilers internal state corrupted.

And in direct affirmation of the principle, the compiler has numerous 
asserts scattered around that _do_ abort compilation should an 
unexpected and invalid state be detected.


More information about the Digitalmars-d mailing list