4 ms·
That won't scale. I'm sure you'll have lots of fun grepping through your source files looking for "!$!$&^!$!!!!" when it appears on your stderr. The point is th
by Hexstream 18y ago
That won't scale. I'm sure you'll have lots of fun grepping through your source files looking for "!$!$&^!$!!!!" when it appears on your stderr. The point is that with an exception system you don't have to write stupid shit like that everywhere just to crash and burn correctly.
Failing loudly is the only sensible behavior when an unexpected error occurs and there's absolutely no indication of what to do in such a case.
- mdakin 18y agoThis is why assert exists. tyger(~)% cat << EOF > main.c ? #include <assert.h> ? ? void main( void ) ? { ? assert( 0 == 1 ) ; ? } ? EOF tyger(~)% gcc main.c main.c: In function ‘main’: main.c:4: warning: return type of ‘main’ is not ‘int’ tyger(~)% ./a.out Assertion failed: (0 == 1), function main, file main.c, line 5. Abort tyger(~)%
- jodrellblank 18y agoFrom what breif comments I've read on Lisp's condition system, it sounds much better. Containing and isolating the error, as soon as possible, then passing information about the error higher up like an exception might propagate, until a level high enough to know the goal of the operation and what to do in case of errors, then passing a response back down, and being able to continue in a useful manner or tidy up gracefully. A great big codesplosion spraying you with a several hundred lines of stack trace and a "Your program has encountered an error an needs to close" is not "sensible behaviour".
- Hexstream 18y ago"A great big codesplosion spraying you with a several hundred lines of stack trace and a "Your program has encountered an error an needs to close" is not "sensible behaviour"." Yes it is, if it's a program in development where I haven't yet decided what behavior an error condition should produce. You guys don't seem to understand I don't necessarily want to decide how to handle all errors now, not that I never want to have to think about how to handle them.