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

Re: dispatching on keywords



I'm not sure error values are such a good idea, even in a functional language.
Expanding on your example, consider:

   (read (open-file ...

With error values, read can get a stream argument or an error value, and so
must check at run time.
With non-local exits and conditions, you can assert that open-file returns a
stream, and the compiler will optimize type checking. Or alternatively, you
can write your own open-file-or-return-error-value, which makes conditions more
powerful than error values.

Another common argument against error values is that usually, you don't know
locally what to do about the error. You miss the larger picture, and it's
better to exit to a higher-level function that will have a better idea about
what to do.

I'll spare you the argument about all modern computer languages using except-
ions/conditions :-)

     Daniel.