should postconditions be evaluated even if Exception is thrown?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Dec 3 09:38:52 PST 2009


Walter Bright wrote:
> Brad Roberts wrote:
>> Walter Bright wrote:
>>> Rory McGuire wrote:
>>>> I would think that if a method in a class throws then at least the
>>>> class' invariant should be run? does it?
>>> No.
>>
>> Do you consider that broken or correct?
> 
> 
> Not sure.

Think Boeing: an exception is a possible and expected error of a 
subsystem. For example, failure to connect with the tower on radio or 
failure of the radar or failure to connect to the GPS satellite. Would 
you expect that such failures make no guarantee about the integrity of 
the plane's controls?


Andrei



More information about the Digitalmars-d mailing list