Re: Exception handling (was: Quickies about the new GObject)



Derek Simkowiak wrote:
> 
>         I'm just getting into Java, but this sounds to me like Java's
> exceptions.  A "throw" is a signal emission of the "exception" signal.
> 

I think you're a little off track here. The key thing (IMHO) about
exception handling mechanisms in languages that have them is that the
binding of handler to exceptions occurs with dynamic scope (as opposed
to lexical scope or some kind of flat global-ish sort of scope).

In other words if you call a piece of code which throws an exception,
that handler that gets invoked is the *most recent* one that the flow of
control for that thread passed through. I don't know much about gtk+
signals, but I'd bet London to a brick that when you set up signal
bindings they don't have this kind of dynamic scope. Faking it by
continually binding and unbinding signals would be expensive and
inconvenient, and probably way more hassle than using explicit error
handling that doesn't rely on non-local exits (aka exceptions).

Regards
M.Beach




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]