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

Re: New Lisp ?



rpw3@rigden.engr.sgi.com (Rob Warnock) writes:
> David Rush  <kumo@bellsouth.net> wrote:
> +---------------
> | Please note: I am talking about a matter of degree here. My biggest
> | beef with exception-based systems is that they end up getting used far
> | too generally (for unusual code paths rather than actual failure
> | handling).
> +---------------
> 
> At least as I read it, Kent Pitman's 1990 survey paper on exceptions
> <URL:http://world.std.com/~pitman/Papers/Exceptional-Situations-1990.html>
> suggests that there's nothing wrong with using exceptions for "unusual
> code paths":

For certain values of "nothing wrong".

> 	It is important to recognize that this distinction between normal
> 	and exceptional situations is in some sense contrived. Making this
> 	distinction does not change the way programs behave; it simply
> 	changes the way we reason about programs--hopefully for the better.

An esthetic judgement.

> 	In some cases, there may be efficiency reasons for considering
> 	some cases to be exceptional.

These costs rarely dominate the costs of an exception system in the
first place. Now in some language RTEs the added cost of
exception-handling is quite small. In others (C++ in particular) it is
not.

> In particular, allowing some [presumably infrequent] non-error code
> paths to be considered "exceptional" [and using inconspicuous flow
> control primitives to access them, such as CATCH/THROW] can, in turn,
> allow the "normal" code paths to be considerably simplified without
> compromising program correctness.

But again, we're talking about slippery-slope issues here. I am not
going to advocate the banning of exceptions. I have found that they
are very easily subjected to 'GOTO considerd harmful'-like abuse. At
the end of the day, programmer discipline is the only answer to crappy
code. Exceptions don't help tremendously in view of their potential
for abuse. This may well change as the programming community at large
learns how to structure exceptional control structures so they don't
degenerate into unreadable spaghetti. Call me back in about 5 years.

david rush
-- 
Open source code "is like lobster, most people who haven't tried it
don't like the way it looks. But those who try it, like it."
	-- Jim Johnson, The Standish Group International