comp.lang.ada
 help / color / mirror / Atom feed
From: mw@ipx2.rz.uni-mannheim.de (Marc Wachowitz)
Subject: Re: Building blocks (Was: Design By Contract)
Date: 1997/09/09
Date: 1997-09-09T00:00:00+00:00	[thread overview]
Message-ID: <5v3b61$r77$1@trumpet.uni-mannheim.de> (raw)


mheaney@ni.net (Matthew Heaney) wrote:
> I've always been curious about the semantics of exception propagation,
> because it doesn't correspond to anything in pure math (or does it?).  If I
> divide x by 0 on paper, I can strug my shoulders and say, "Oh well,
> division by 0 isn't defined," but on a computer, I have to do _something_. 

That's easy. All functions (or generally procedures, or any statements and
expressions) can be seen as mappings from one state to another, and among
the possible outcomes of a such functions are the "normal outcome", where no
exception was raised, and some "abnormal outcome" (possibly indicating the
detailed cause for the exception as well, whether just with a name, or with
additional data, like the error code of some system call). In the area of
applicative languages, and the associated theory, there's even something
known as continuation-passing style, where any sequence of computation is
made explicit by passing to every function another function, the so-called
continuation, which is invoked with the result of the former function. Then
control structure manifests as a choice between many possible continuations.
You could model the dynamic nesting of exception handlers by passing to each
function (in the general sense; i.e. also expressions/statements) both a
continuation for normal cases and a continuation for exceptional cases, and
functions without any own exception handlers would pass along whatever they
received as their exception-continuation. When an exception handler doesn't
propagate the exception, that means that it invokes the appropriate normal
continuation of its own context.

In Scheme (a Lisp dialect), continuations are even available to programmers
and can be used to model a variety of other control structures, including
exceptions, but also backtracking or coroutines. (For detailed background,
I suggest you ask on comp.lang.scheme about these things; there are people
who can probably give you better references to books or papers on the net
than the little I'd have available.)

-- Marc Wachowitz <mw@ipx2.rz.uni-mannheim.de>




             reply	other threads:[~1997-09-09  0:00 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-09-09  0:00 Marc Wachowitz [this message]
  -- strict thread matches above, loose matches on Subject: below --
1997-09-11  0:00 Building blocks (Was: Design By Contract) Robert Dewar
1997-09-09  0:00 Marc Wachowitz
1997-09-15  0:00 ` Joachim Durchholz
1997-09-17  0:00 ` Paul Johnson
1997-09-18  0:00   ` Stephen Leake
1997-09-18  0:00     ` Mark L. Fussell
1997-09-19  0:00       ` Jon S Anthony
1997-09-23  0:00         ` Mark L. Fussell
1997-09-19  0:00       ` Robert A Duff
1997-09-20  0:00         ` Joachim Durchholz
1997-09-22  0:00           ` Matthew Heaney
1997-09-23  0:00             ` Joachim Durchholz
1997-09-23  0:00             ` Veli-Pekka Nousiainen
1997-10-03  0:00               ` Robert I. Eachus
1997-10-04  0:00                 ` Paul Johnson
1997-10-14  0:00                   ` Robert I. Eachus
1997-09-23  0:00           ` Jon S Anthony
1997-09-24  0:00           ` Richard A. O'Keefe
1997-09-24  0:00           ` Alan E & Carmel J Brain
1997-09-25  0:00             ` Anonymous
1997-09-30  0:00               ` Alan E & Carmel J Brain
1997-09-30  0:00                 ` Matthew Heaney
1997-09-30  0:00                   ` Neil Wilson
1997-09-30  0:00                     ` Stephen Leake
1997-09-30  0:00                   ` W. Wesley Groleau x4923
1997-09-30  0:00                     ` Matthew Heaney
1997-10-01  0:00                     ` Alan E & Carmel J Brain
1997-10-01  0:00                 ` Anonymous
1997-10-01  0:00                   ` Joachim Durchholz
1997-10-01  0:00                   ` Paul M Gover
1997-10-04  0:00                     ` Paul Johnson
1997-10-04  0:00                       ` Matthew Heaney
1997-10-15  0:00                         ` Paul Johnson
1997-10-15  0:00                           ` Matthew Heaney
1997-10-16  0:00                             ` Joachim Durchholz
1997-10-17  0:00                               ` Robert I. Eachus
1997-10-16  0:00                           ` Joachim Durchholz
1997-10-22  0:00                           ` Reimer Behrends
1997-10-02  0:00                   ` Robert A Duff
1997-10-02  0:00                     ` Tucker Taft
1997-10-02  0:00                       ` Matthew Heaney
1997-10-03  0:00                     ` Stephen Leake
1997-10-04  0:00                     ` Matthew Heaney
1997-10-07  0:00                       ` Robert A Duff
     [not found]       ` <11861963wnr@eiffel.demon.co.uk>
1997-09-19  0:00         ` Mark L. Fussell
1997-09-18  0:00     ` W. Wesley Groleau x4923
1997-09-21  0:00       ` Matthew Heaney
1997-09-18  0:00   ` Jon S Anthony
1997-09-18  0:00   ` Robert Dewar
1997-09-02  0:00 Design By Contract Jon S Anthony
     [not found] ` <JSA.97Sep3201329@alexandria.organon.com>
1997-09-04  0:00   ` Paul Johnson
     [not found]     ` <5un58u$9ih$1@gonzo.sun3.iaf.nl>
1997-09-06  0:00       ` Building blocks (Was: Design By Contract) Joachim Durchholz
1997-09-08  0:00       ` Paul Johnson
1997-09-08  0:00         ` Brian Rogoff
1997-09-09  0:00           ` W. Wesley Groleau x4923
1997-09-09  0:00           ` Matthew Heaney
1997-09-09  0:00             ` W. Wesley Groleau x4923
1997-09-10  0:00               ` Robert A Duff
1997-09-12  0:00                 ` Jon S Anthony
1997-09-09  0:00             ` Brian Rogoff
1997-09-10  0:00             ` Robert Dewar
1997-09-12  0:00               ` Paul Johnson
1997-09-14  0:00                 ` Robert Dewar
1997-09-14  0:00                 ` Robert Dewar
1997-09-15  0:00                   ` John G. Volan
1997-09-14  0:00                 ` Robert Dewar
1997-09-12  0:00               ` Jon S Anthony
1997-09-12  0:00                 ` Robert Dewar
1997-09-16  0:00                   ` Brian Rogoff
1997-09-10  0:00             ` Paul Johnson
1997-09-10  0:00               ` Darren New
1997-09-10  0:00               ` Matthew Heaney
1997-09-09  0:00           ` Veli-Pekka Nousiainen
1997-09-09  0:00           ` Veli-Pekka Nousiainen
1997-09-09  0:00             ` Jon S Anthony
replies disabled

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