[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
dispatching on keywords
- To: email@example.com
- Subject: dispatching on keywords
- From: Stavros Macrakis <firstname.lastname@example.org>
- Date: Wed, 18 Nov 1992 10:22:25 -0500
- Cc: email@example.com, firstname.lastname@example.org
- In-reply-to: Jim Mayer's message of Tue, 17 Nov 1992 06:14:41 PST <9211171414.AA29098@fliff.wrc.xerox.com>
- Sender: email@example.com
... an interesting Ph.D. dissertation...by Andrew Black, out of
Oxford, and is titled "Exception Handling: the Case Against." ...
It appeared as U. of Washington CS Dept. tech report 82-01-02
(although it is an Oxford thesis). I don't know if it was published
The paper looks at, and classifies, a number of different proposed
exception handling mechanisms. It...argue[s] that the combination
of first class procedures and "oneof" (tagged union) values covers
all of the interesting cases....
Yes. In the language framework he uses, unboxing the union requires a
case statement which must cover all cases, thus allowing static
checking. But the language framework is different in many ways from
Dylan's, in particular being as static as possible.
I think it is worthwhile also to quote his criticism of the use of
zero as an error return:
Assigning 'v' to zero and continuing with the computation is sensible
in two kinds of situation. The first occurs when zero is not valid as
a value..... This implies that the ... abstraction should have been
instantiated with some other 'v', say "Natural" [instead of Integer].
Thus 'v' is really of a union type: it is either a 'v' or it is zero.
The program fragment represented by '<use v>' will presumably test 'v'
to see if it is zero before deciding to proceed. There is nothing new
or surprising about this use of zero as an "impossible" value: it has
a history going back to the days of assembly language and Fortran.
However, the advantages of languages like Pascal and Alphard is that
one can construct types containing just the values one needs and thus
obtain clearer code and more checking at compile time. Using union
types preserves these benefits at the cost of having to make explicit
checks and type conversion. Adding "impossible values" to existing
types allows those conversions to be avoided, but negates many of the
benefits of strong typing. ...
The second kind of situation in which it is sensible for 'v' to be
assigned to zero occurs when zero is some sort of default
The second case is simply not an error return at all. But the first
case I think applies equally well to using #f as a non-return or