...
> Then the code which draws the graph just needs to do some pattern
> matching on the `MaybeException y' at the appropriate place:
> 
>       plot_point x (OK y) = ...
>       plot_point x (GotException exception) = ...

Better than the IO monad suggestion, but it still partially misses my
point.  And quite a big portion of it.

1. One part that is missed is that there still may be a value to
consider, in this example, to plot (assuming that the computations of
the 'y's went on uninterrupted!).  At least in this example you loose
the value.

2. Related to 1, is that it may be quite reasonable to let the
computation, of "a y" here, to go on and produce a value (too!).  In
IEEE f.p., this value would often, but not always, come out as +0, -0,
+inf, -inf, or NaN; or indeed *any other (f.p.) value*  (e.g.
arctan(1/0), which is arctan(+inf), which is pi/2; the computation can
go on, remembering that there was a divide-by-zero).  The continuation
values (for IEEE floating point) have been carefully chosen so that the
result can be reasonable, though often, but not always, inexact.  The
main point here is that the (f.p.) result *need not* be a NaN, even if
an exception occurred!

3. During the course of continued evaluation other exceptions may occur
as well, but in the 'NDset' scheme you can have only one of them,
allegedly non-deterministically chosen.

Sorry for concentrating so much on floating point, but for floating
point there is a widely accepted specification on how to handle the
exceptions that may occur.

                        Regards
                        /kent k


Reply via email to