|
![](/i/fill.gif) |
>> As far as I can tell, an "error" is a situation that arises due to a
>> bug in your program, whereas an "exception" is when a situation is
>> caused by external events that you can't control.
>
> Huh. I would say an error is something you don't want to have happen,
> and an exception is a data structure describing an alternate return
> value from a function. If this is really how it's worded, then there's
> definitely a problem of crossing meta boundaries.
I'm not quite sure what to make of that, other than "people have
different terms for things".
Then again, this is from the community where "parallel" and "concurrent"
aren't the same thing...
>> Some people have even gone as far as to suggest that it's a design
>> flaw that errors can be caught.
>
> Yes, only in an academic environment, tho. :-)
Well, yeah, there is that. This is Haskell, after all. *sigh*
>> Amusing thing: Last time I checked, a GHC program exits when thread #0
>> exits. And if (say) thread #13 throws an exception which isn't caught,
>> then thread #13 just exits, and the rest of the system keeps running.
>> Isn't that fun? :-)
>
> That's pretty much how most systems with threads work, as far as I know.
> Some have a mechanism that waits for all threads that aren't
> "background" threads to exit, tho, if that's what you mean, but that
> just means that there's a blob of code at the end of Thread#0 that says
> "iterate thru all non-background threads and wait for them to exit."
It just amuses me that if you have a single-threaded program that throws
an exception, the program halts and prints out a message on stderr. But
as soon as you have multiple threads... this doesn't happen any more.
You'd think it would make more sense to rethrow an uncaught exception to
thread #0, but anyway...
The GHC threading implementation also lacks things like being able to
assign priorities to threads, and so forth. But hey, at least it works.
--
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*
Post a reply to this message
|
![](/i/fill.gif) |