On 15 mar 2012, at 23:57, Jonathan M Davis wrote:

> On Thursday, March 15, 2012 15:25:32 Walter Bright wrote:
>> 
>> If you want to recover, use an Exception.
> 
> In general, I agree. It's just that there are a few cases where it makes 
> sense. The main one has to do with unit tests. In some cases, it makes sense 
> to catch an AssertError within a unit test, because assert is what's used in 
> unit tests. For instance, some programmers want to test their in contracts. 
> The biggest case though is that some programmers want to build more extensive 
> unit testing frameworks on top of the built-in one. And to do that, you have 
> to catch AssertErrors. Personally, I see no need for such frameworks, but 
> some 
> people (e.g. Jacob Carlborg) definitely want them, and if AssertErrors skip 
> scope statements, finally blocks, or destructors, that's going to cause major 
> problems for their frameworks.

I see three ways to solve this:

* Make it safe to catch errors
* Make assert throw an exception
* Make the onAssertError callback usable

Is it possible we can agree on something here or would I need to have my own 
"assert" function.

-- 
/Jacob Carlborg

_______________________________________________
dmd-internals mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/dmd-internals

Reply via email to