|
|
>> Yeah, but if the Haskell runtime has code to handle printing out a
>> human-readable error message on an unhandled exception, why can't it
>> also run some finalisers? This is pretty basic stuff!
>
> Yep, true. I didn't realize you meant "exited cleanly due to an
> unhandled exception." I thought you meant "crashed out due to a signal,
> or running out of memory, or some such."
>
> I suppose you could theoretically do a final GC and finalize before you
> exited (but perhaps before you printed the exception stack?), but I
> think at that point you're already pretty screwed. :-)
Basically, all you have to do is write a Haskell program that calls the
"error" function somewhere, and your program will exit without closing
anything behind it. Unless *you* remembered to take steps to prevent that.
That seems... a little unsafe to me.
Still, at least the code to do it isn't that hard.
bracket
(openFile "Foo.txt" ReadMode)
(hClose)
(\file_handle -> ...do stuff...)
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
|