should postconditions be evaluated even if Exception is thrown?
Brad Roberts
braddr at bellevue.puremagic.com
Thu Dec 3 14:11:33 PST 2009
On Thu, 3 Dec 2009, Pelle M?nsson wrote:
> Andrei Alexandrescu wrote:
> > As others have mentioned, you may have different postconditions depending on
> > whether an exception was thrown or not.
> >
> > I think a major failure of exceptions as a language mechanism is that they
> > gave the illusion that functions need not worry about what happens when an
> > exception traverses them, and only need to focus on the success case.
> >
> >
> > Andrei
> In the case of special postconditions for exceptions, I agree it should be
> there. Something to replace the finally.
No, post conditions do NOT replace finally. Finally is body code, often
cleanup functionality. Post-conditions are validation.. checking
correctness. PC is specifically NOT about cleanup or any data
modification.
More information about the Digitalmars-d
mailing list