[Haskell-cafe] Documenting the impossible
r.kelsall at millstream.com
Sun Jun 15 09:25:00 EDT 2008
Andrew Coppin wrote:
> Obviously there is no way in hell this code path can ever be executed.
Ah, the number of times I've thought that and been wrong :)
From a simplistic perspective what I think you're asking for is
to have obscure occasions when your program goes wrong with random
consequences and doesn't give you an error message. This a programmer's
worst nightmare. I can think of several dimensions of bug difficulty
When the bug exhibits:
Hard : Infrequent at run-time.
Medium : Frequent at run-time.
Easy : Compile-time.
Hard : No obvious pattern or way to induce the error.
Medium : A reasonably strong correlation with some precursor.
Easy : Happens every time you do a particular thing.
Hard : No error message.
Medium : Non-specific error message.
Easy : Error message that relates to an identifiable
point in your program with relevant state information.
Error message location:
Medium : Appears on the screen.
Easy : Shown on screen and recorded in a log file.
Where it happens:
Hard : Only on your user's machine or with their configuration.
Easy : On all machines.
By classifying error messages, for bugs which you have stated are
infrequent and difficult to reproduce, as not needing to be displayed
or logged you have pushed all these bugs into the seriously hard
category. By adding 'undefined' subsequent behaviour you have made
these bugs even more difficult. What we should be doing is pushing
every bug in the opposite direction - towards the easy end of all
the above dimensions.
More information about the Haskell-Cafe