Program logic bugs vs input/environmental errors
Walter Bright via Digitalmars-d
digitalmars-d at puremagic.com
Sat Oct 11 15:06:39 PDT 2014
On 10/9/2014 10:31 AM, Dicebot wrote:
> On Thursday, 9 October 2014 at 16:33:53 UTC, Johannes Pfau wrote:
>> I think Walter sometimes suggested that it would be valid for a
>> compiler to not unwind Errors at all (in release mode), but simply kill
>> the program and dump a error message. This would finally allow us to
>> optimize nothrow functions.
>
> I think this is reasonable in general but as long as assert throws Error and
> assert is encouraged to be used in unittest blocks such implementation would
> mark compiler as unusable for me.
All assert actually does is call a function in druntime. You can override and
insert your own assert handling function, and have it do as you need. It was
deliberately designed that way.
> We may need to have another look at what is truly an Error and what is not
> before going that path.
This involves making some hard decisions, but is worthwhile.
More information about the Digitalmars-d
mailing list