A question about DbC

Jonathan M Davis jmdavisProg at gmx.com
Sat Oct 9 04:06:40 PDT 2010


On Saturday 09 October 2010 03:47:52 Denis Koroskin wrote:
> Why not just throw an exception and get a nice stack trace?

You get a stack trace anyway with an assertion failure. And sure, they _could_ 
make it so that the only way to output anything from a contract is to use an 
exception, but not only would that be more of a pain than using writeln(), but 
it would mean that the only time you could output anything would be on failure. 
As it is, you can print something every time that a contract is run. You 
couldn't do that with an exception.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list