4 ms·
In ObjectStudio Smalltalk, there was a "top level exception handler." So long as you weren't doing something involving call-outs to C or custom primitives, you
by stcredzero 11y ago
In ObjectStudio Smalltalk, there was a "top level exception handler." So long as you weren't doing something involving call-outs to C or custom primitives, you could just set the top level exception handler to an empty block. (Empty lambda)
Tada! No exceptions! (Of course, this is the worst possible thing to do.)
It's kind of cheating because Smalltalk exceptions were mostly just ordinary Smalltalk execution. You could start writing your own debugger and be browsing stack traces in a matter of minutes.
- revelation 11y agoYou can do that easily on Windows by adding a Vectored Exception Handler (VEH). But of course that doesn't make exceptions go away, you just save on stack unwinding (if you discard the exception), there is still a pretty big overhead.
- mikeash 11y agoApple's Cocoa framework (for Mac, I don't think this is true on iOS) surrounds each event callout with an exception handler that logs any exceptions and otherwise swallows them and allows execution to proceed. It's a bit crazy, and frustrating if you cause an exception to be thrown but don't notice until it's too late to figure out where it came from, or don't know why suddenly the app is behaving strangely since the exception left things in an inconsistent state.
- pcwalton 11y agoYou can do that in C too with libsigsegv: https://www.gnu.org/software/libsigsegv/ https://www.gnu.org/software/libsigsegv/ Windows 3.1 even shipped with something that basically did just that: https://blogs.msdn.microsoft.com/oldnewthing/20150717-00/?p=90881 https://blogs.msdn.microsoft.com/oldnewthing/20150717-00/?p=...