[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dispatching on keywords
- To: firstname.lastname@example.org, email@example.com, firstname.lastname@example.org
- Subject: Re: dispatching on keywords
- From: Ranson <ranson@LANNION.cnet.fr>
- Date: 17 Nov 92 08:16:00 GMT
- Cc: email@example.com
- X400-received: by /PRMD=inria/ADMD=atlas/C=FR/; Relayed; 17 Nov 92 08:14:39+0100
- X400-received: by /PRMD=CNET/ADMD=ATLAS/C=FR/; Relayed; 17 Nov 92 08:16:00 GMT
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-