lua-users home
lua-l archive

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


On Sat, May 5, 2001, Reuben Thomas <rrt@dcs.gla.ac.uk> wrote:

> [...] The point of exceptions is that you only catch those that you
> *do* know what to do with; the others you just pass through. [...]

That's one part of it.  To be really effective, exceptions need to be
"structured", i.e. the ability to derive similar - but special-case -
exceptions, as Python and C++ support (and Tcl does not).  The point is
that you can as library designer create special kinds of, say, an IO
expection with extra details or some specific meaning, whereas the
library user just decides to catch all IO exceptions and treat them in
the same generic manner.  Both Python and C++ support this with (base)
exception classes, and derived exception classes.

If Lua is given more exception-handling capabilities, I would hope that
the above issue is addressed.  Raw "one-dimensional" exceptions can be
extremely awkward in large applications.  Python appears to strike a good
balance between the width and depth of the exception hierarchy.

-jcw