Version 1 of Define Errors Out of Existence

Updated 2021-11-30 15:25:03 by SEH

Define Errors Out of Existence is a strategy described by John Ousterhout in A Philosophy of Software Design.

See Also

TIP #323: Do Nothing Gracefully
Lists various procedures that do nothing rather than returning an error.

Description

Ousterhout uses unset as an example of a procedure that should have used to this strategy. Instead, it returns an error if a named variable does not exist.

Examples

dict exists
Does not return an error if the first value is not a dictionary. Instead, the answer is "no". Apparently it was decided that it is preferable to allow a script to continue under that false assumption that it is working with dictionary.
lindex and lrange
There is no integer that results in an error. Negative integers and integers larger than the index of the last item are all perfectly acceptable.
binary scan
Does not return an error when it encounters a character having a Unicode code point greater than 255. Instead, it reads only the lower byte of the, ignores higher byte. Apparently in this case it was decided that data loss is preferable to returning an error.

Page Authors

pyk