[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnu-arch-users] Nit
From: |
Tom Lord |
Subject: |
Re: [Gnu-arch-users] Nit |
Date: |
Tue, 21 Oct 2003 09:11:15 -0700 (PDT) |
> From: "Mark A. Flacy" <address@hidden>
> Because many authors will think that their software layer should throw
> certain exceptions and only those exceptions.
That's a good principle but it's only half the story.
Each call should only _expect_ certain exceptions and no exception
should get past a call-site that doesn't explicitly say it's expected.
Suppose I add a new throw to a function I maintain -- a new exception
that that function might throw. Must I find all callers and make sure
that the new exception type won't screw them up?
For a while I was thinking it could all be done with just
declarations:
Module A declares what exceptions it can generate.
Module B uses A and declares what exceptions it thinks A can
generate.
but that doesn't quite cut it. Module A might generate a no_such_user
exception that I actually want to forward from some call sites into A
but not from others. I think you really do want a per-call-site
enumeration of forwarded exceptions.
> We've beaten into most of our designers that if you aren't going
> to do anything with the exception other than re-throw it, don't
> catch the damned thing. That's a runtime cost for no purpose.
If it were really an issue a compiler could do a good job with that.
> Java programmers should never catch Exception, print nothing and
> do nothing with the exception. Bad idea.
By default, they should catch Exception all over the place and abort
-- letting through only those exceptions they explicitly intend to.
The language should be extended with syntax to make that easy.
-t
- Re: [Gnu-arch-users] Nit, (continued)
- Re: [Gnu-arch-users] Nit, Andrew Suffield, 2003/10/20
- Re: [Gnu-arch-users] Nit, Dustin Sallings, 2003/10/20
- Re: [Gnu-arch-users] Nit, Andrew Suffield, 2003/10/20
- Re: [Gnu-arch-users] Nit, Dustin Sallings, 2003/10/20
- Re: [Gnu-arch-users] Nit, Tom Lord, 2003/10/20
- Re: [Gnu-arch-users] Nit, Dustin Sallings, 2003/10/20
- Re: [Gnu-arch-users] Nit, Momchil Velikov, 2003/10/21
- Re: [Gnu-arch-users] Nit, Robin Farine, 2003/10/21
- Re: [Gnu-arch-users] Nit, Mark A. Flacy, 2003/10/21
- Re: [Gnu-arch-users] Nit, Robin Farine, 2003/10/21
- Re: [Gnu-arch-users] Nit,
Tom Lord <=
- Re: [Gnu-arch-users] Nit, Dustin Sallings, 2003/10/21
- Re: [Gnu-arch-users] Nit, Tom Lord, 2003/10/21
- Re: [Gnu-arch-users] Nit, zander, 2003/10/21
- Re: [Gnu-arch-users] Nit, zander, 2003/10/21
- Re: [Gnu-arch-users] Nit, Tom Lord, 2003/10/21
- Re: [Gnu-arch-users] Nit, zander, 2003/10/21
- Re: [Gnu-arch-users] Nit, Tom Lord, 2003/10/21
- Re: [Gnu-arch-users] Nit, Charles Duffy, 2003/10/21
- Re: [Gnu-arch-users] Nit, Tom Lord, 2003/10/21
- Re: [Gnu-arch-users] Nit, Andrew Suffield, 2003/10/21