From: Christophe R. <cs...@ca...> - 2014-04-16 07:53:19
|
Attila Lendvai <att...@gm...> writes: > i just had a thought on WITH-DEADLINE while guarding a piece of code > against any SERIOUS-CONDITION: > > (handler-case > (something-short-that-may-fail-but-its-ok) > (serious-condition () > (log-a-warning-and-move-on))) > > this seems to be a reasonable piece of code, but if it's used in a > context where there is a deadline installed, and if that deadline is > signalled from inside of it, then it'll muffle the deadline. > > is this code bad style? I would say "yes": handling all SERIOUS-CONDITIONs indiscriminately (and moving on) is likely to be a bad thing. The SERIOUS-CONDITIONs that are not ERRORs are things that are conceptually the computer going wrong: running out of heap or stack space, detecting memory corruption errors -- the kinds of thing that probably warrant something more than being caught by a generic handler-case. ERRORs, by contrast, are conventionally things going wrong with the program or its execution. I don't know whether deadlines are conceptually ERRORs or SERIOUS-CONDITIONs, but even if they're implemented that way it doesn't make it OK to handle all the other kinds of ways in which the computer can go wrong. Cheers, Christophe |