2 ms·
The condition system is often hard for non-lisp people to understand as the best they’ve had in the past is a core dump or a c++-style exception system. The ma
by gumby 6y ago
The condition system is often hard for non-lisp people to understand as the best they’ve had in the past is a core dump or a c++-style exception system. The main problem for me with those is that by the time you see the exception the state has already been destroyed. This is the problem with core dumps as well: all your files and network connections have been closed. The only alternative is to use a debugger which is a high overhead situation.
The roots of condition system evolved from two related hacker environments: the ITS system at the MIT AI lab and the lisp machines (both CADR and its descendants and the PARC D-machines) as well as influence for the Smalltalk folks.
In ITS what is called the “shell” these days was the debugger. If your program signaled an error you were immediately in the debugger and could debug, just exit, or Force a core dump. This was the routine way to interact, even for non-programmers. The lispm did the same. Debugging was a lightweight operation.
So it was natural in the 80s to develop a system that formalized this mode of operation. Because an exceptional situation by definition requires greater knowledge than is available in situ. When you catch an error in java or can++ it’s too late to look at the state of the object that caused the error without standing on your head and possibly redesigning the try block say to allocate something on the heap that can be passed to the error (which means no more RAII etc etc).
In addition, try/catch typically puts the hand lin too close to the site of the problem for you to be useful; if not, by the time you get the exception there’s not much you can do but terminate the calculation politely.
- phoe-krk 6y ago> The main problem for me with those is that by the time you see the exception the state has already been destroyed. This is the problem with core dumps as well: all your files and network connections have been closed. The only alternative is to use a debugger which is a high overhead situation. This seems like two core issues with understanding the condition system. First, the currently popular exception systems always destroy the stack by unwinding it, allowing the programmer to debug only dead remains instead of a living program; second, debuggers are bolted on top of programs instead of being their internal parts, which gives many people an impression that using them as an integral part of the whole programming lifecycle is inconvenient and unnatural. The condition system in Common Lisp solves both of these issues, which IMO, paradoxically, contributes to it not being well understood outside Lisp circles.