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

Re: condition systems?



Ken Anderson <kanderson@bbn.com> writes:

> What about condition systems, or exception handling?  Are they worth
> discussion in the context of lightweight languages?  My guess is
> yes, but i don't recall such a thread on this list.

I like Erlang's "processes and links" error handling mechanism a great
deal. It's documented in chapters 7 and 8 of the Erlang book,
http://www.erlang.org/download/erlang-book-part1.pdf

One interesting aspect is that it isn't stack-based - it's more like
Unix SIGCHLD than Java exceptions. Another is that it gets you
thinking of invariants - "if this process fails for _any_ reason,
then", rather than "if this socket bind() fails, then.."

I have a favourite quote about this, found in one of the original
erlang papers:

  In programming large systems, many small programming errors _will_
  be made - we view this as inevitable. Formal systems and exhaustive
  test procedures are currently not capable of ensuring fault free
  software for systems of the size and complexity of modern telecomms
  applications. Given that errors _will_ be made, we are interested in
  the problem of detecting and handling those errors in such a manner
  that the system as a whole exhibits satisfactory behaviour _in the
  presence of errors_.

Cheers,
Luke