On Sunday, 12 August 2012 at 04:36:22 UTC, Jonathan M Davis wrote:
On Saturday, August 11, 2012 21:27:43 Walter Bright wrote:
Anyhow, that article is why D does not have exception
specifications. Also,
please note that C++ dropped exception specifications.
Though it should be noted that exception specifications are
_far_ worse than
checked exceptions, because they're checked at runtime instead
of compile
time, and they kill your program if they fail. So, instead of
all of the
problems that you get with checked exceptions, you get your
program killed at
runtime when you don't get your code quite right.
I think that you're going to have a hard time finding _anyone_
who actually
understands what C++'s exception specifications do and still
thinks that
they're a good idea, whereas you _will_ find people who fully
understand
checked exceptions and still think that they're a good idea.
- Jonathan M Davis
Yup, I'm among them, and I believe the only problem with checked
exceptions is that most people don't understand how to use them.
The main problem people have with checked exceptions is that they
are forced to handle error/exceptional cases, and therefore to
think about them. To my knowledge, there are no absolute rules or
truths in error handling, and therefore it seems it throws people
in all sorts of perplexity, because when it's not specified,
programmers have no idea who is supposed to handle an exception,
and how. So the worst offenders wipe them under the rug, which is
borderline criminal, because it can make it nearly impossible to
find the root cause of some runtime errors. Exceptions are
integral part of an interface, not an afterthought, i.e they are
part of an API design. But most average programmers never think
about error handling until the program explodes in their face (or
that of the customer). When one thinks about error handling
upfront, checked exceptions aren't a problem, they are a very
useful tool, and I use them all the time.