should postconditions be evaluated even if Exception is thrown?
Leandro Lucarella
llucax at gmail.com
Fri Dec 4 10:20:43 PST 2009
Michal Minich, el 4 de diciembre a las 14:13 me escribiste:
> Hello Leandro,
>
> >I think postconditions should only be able to inspect (in a read-only
> >manner) the exception; once the postcondition finished executing, the
> >exception should be propagated as is.
> >
>
> heating up the processor for no effect whatsoever?!
>
> Note also that it is possible, and desired, to use assert statement
> in conditions; this statement can throw Error (it is corner case of
> changing behavior of program, but we can consider that it is not
> changing anything, because it should end the program very fast
> anyway).
Well, yes, failing a postcondition should be a non-recoverable Error, and
that's an exception, you're right. But I don't think being able to throw
any non-Error should be allowed. I think only asserts should be allowed
(not throwing using throw), and assert should in post/pre-conditions
should dump a core, no more, no less.
--
Leandro Lucarella (AKA luca) http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
Agitamos toda la zona de la paleta al horno, vemos que una luz nos
atraviesa toda la zona intestinal...
-- Sidharta Kiwi
More information about the Digitalmars-d
mailing list