gnu-arch-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnu-arch-users] Nit


From: Miles Bader
Subject: Re: [Gnu-arch-users] Nit
Date: Tue, 21 Oct 2003 20:03:21 -0400
User-agent: Mutt/1.3.28i

On Tue, Oct 21, 2003 at 04:24:05PM -0700, Dustin Sallings wrote:
> >It must be handled _somewhere_up_the_call_graph_.  It must be in the
> >throws list of my method.  But Java does _not_ require that it be
> >handled at the call-site.  It's that distinction that is at issue.
> 
>       I understand what you're saying about throws-per-call, and it sounds 
> like an interesting idea, but as you say, it isn't much different from 
> return values.  I believe this reduces the value.

I believe the idea is that for maximum safety, it _should_ basically be like
another sort of return -- however it's much more convenient that using the
normal return value for the same purpose (as one usually does in C).
I personally think that the `exception as a funny sort of return' is exactly
the right thing; it makes programs easier to think about, whereas
exceptions-that-pop-up-the-call-stack-N-levels seem to make things fuzzier.

Check out clu (the language)* for a very nice implementation of this sort of
exception.  Note that in the case where an exception _isn't_ handled
immediately by the caller, clu turns it into an `unhandled exception'
exception, which is implicitly part of the return value of every function.

The question of whether exceptions should propagate past the immediate caller
is an old and hoary one in CS; I'm not aware of any definitive resolution.

-Miles

* clu is a generally a very nice language, BTW; to borrow Tom's words about
  lua, it's a language of `startling clarity.'  [did I mention that lua also
  somewhat resembles clu? :-]
-- 
Somebody has to do something, and it's just incredibly pathetic that it
has to be us.  -- Jerry Garcia




reply via email to

[Prev in Thread] Current Thread [Next in Thread]