comp.lang.ada
 help / color / mirror / Atom feed
From: Darren New <dnew@san.rr.com>
Subject: Re: Ada exceptions. unchecked?
Date: Thu, 13 Jun 2002 18:37:11 GMT
Date: 2002-06-13T18:37:11+00:00	[thread overview]
Message-ID: <3D08E672.39F64AE4@san.rr.com> (raw)
In-Reply-To: 3D08DF3F.5080800@mail.com

Hyman Rosen wrote:
> 
> Darren New wrote:
> > Because it prevents the programmer from ignoring the problem. Note, I didn't
> > say it prevents the *program* from ignoring it, but the *programmer*.
> >
> > That is, with checked exceptions, you can't call malloc() without checking
> > the result, even if every single time you test the program, you manage to
> > allocate enough memory.
> 
> Are we talking about the same thing here? The whole point
> of exceptions is exactly to call malloc without checking
> the result. 

I guess it depends on your philosophy. If the creators of Java were looking
at C and saying "what are common errors that people make" I can see this
being the idea.

> With exception-based error handling, code is
> written as if errors never happen, and resource allocation
> is done with objects which release the resource when their
> lifetime ends.

Well, yes, in languages where objects have a definite lifetime, this is
true. Java isn't like that. Java, instead, has garbage collection. Look at
Eiffel for yet another take on exception-based error handling.

I'm not saying Java's take on this is right, and I'm not saying it's the
best way to handle it. I'm just saying that's how it is. I am explicitly
*not* trying to convince you it's good. I don't even think it's good myself.

> Then if an error does happen, the exception
> propogates out to a handler which usually deals with the
> situation in a high-level fashion, and allocated resources
> between the point of the exception and the handler are
> cleaned up.

Yes, and by declaring what exceptions get thrown, you're telling people who
are calling your library "hey, here's the exceptions you have to handle in a
high-level fashion." Works great, until someone else writes part of the
code, and then they call one of your routines.

-- 
Darren New 
San Diego, CA, USA (PST). Cryptokeys on demand.
** http://home.san.rr.com/dnew/DNResume.html **
** http://images.fbrtech.com/dnew/ **

     My brain needs a "back" button so I can
         remember where I left my coffee mug.



  reply	other threads:[~2002-06-13 18:37 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-12  7:00 Ada exceptions. unchecked? steve_H
2002-06-12 13:52 ` Ted Dennison
2002-06-12 14:09 ` Larry Kilgallen
2002-06-12 13:47   ` Mark Johnson
2002-06-12 15:40     ` Larry Kilgallen
2002-06-12 16:07       ` Darren New
2002-06-12 22:21         ` Dale Stanbrough
2002-06-13 14:36           ` Hyman Rosen
2002-06-13 16:41             ` Darren New
2002-06-13 17:13               ` Hyman Rosen
2002-06-13 17:48                 ` Darren New
2002-06-13 18:06                   ` Hyman Rosen
2002-06-13 18:37                     ` Darren New [this message]
2002-06-13 19:14                       ` Hyman Rosen
2002-07-05 14:35                         ` Stephen J. Bevan
2002-06-12 19:25     ` Simon Wright
2002-06-12 22:19     ` Gisle Sælensminde
2002-06-13 14:27       ` Mark Johnson
2002-06-14 21:32         ` Gisle Sælensminde
2002-06-14 21:45           ` Darren New
2002-06-15 15:10           ` Simon Wright
2002-06-15 21:26             ` AG
2002-06-15 23:37               ` Darren New
2002-06-15 23:50                 ` AG
2002-06-15 23:57                   ` Darren New
2002-06-17 18:21             ` Charles Lindsey
2002-06-18 16:32             ` Stephen Leake
2002-06-18 19:48               ` Wes Groleau
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox