[phobos] Calling abort() on unhandled exception
Andrei Alexandrescu
andrei at erdani.com
Fri Jul 30 17:37:32 PDT 2010
Leandro Lucarella wrote:
> That's not an exception!!!! What's the point of that???? Why don't you
> just write a library function like like enforce but that uses exit(1)
> instead of throwing an exception for that?!?!?! You really want to
> sacrifice the correct behavior for this dumb, dumb "feature"???
> This really makes me mad! God...
Relax, we're all on the same boat. To answer each question in sequence:
1. The point of that is to terminate the program if the number of
arguments passed is not satisfactory.
2. I don't write a library function like enforce that uses exit(1) because:
2.1. I'd have to write a ton of them.
2.2. I don't want to exit(1), I want to correctly propagate an
exception. In this particular case it would exit straight out of main so
it's the same as exit(1) but many scripts have more than one function.
3. I don't want to sacrifice correct behavior for anything in
particular. It is your view that the behavior you like is correct and
the one I like is incorrect.
> Plus *ANY* other programming language mark uncaught exceptions as
> OBVIOUS ERRORS (they print traces or abort()).
Not Perl for example. I don't know whether Java prints the stack by
default or not.
Andrei
More information about the phobos
mailing list