Re: catching exceptions
- From: muppet <scott asofyet org>
- To: Gabor Szabo <szabgab gmail com>
- Cc: GTK2-Perl List <gtk-perl-list gnome org>
- Subject: Re: catching exceptions
- Date: Wed, 30 Apr 2008 08:03:22 -0400
On Apr 30, 2008, at 6:47 AM, Gabor Szabo wrote:
Hi,
On Wed, Apr 30, 2008 at 8:04 AM, muppet <scott asofyet org> wrote:
On Apr 29, 2008, at 9:48 AM, Gabor Szabo wrote:
Can I catch this exception somehow?
With some work, yes, you can trap it with a perl handler. This is
not
really generic, though, and is not a proper solution to your problem.
As a Perl programmer I think I should be able to trap every
exception, even if that occurs in the C-level code beneath.
I think it would be better if the Perl binding would trap these and
throw them as exceptions in the Perl code.
Please consider adding this to future releases of Gtk2.
While i agree that a perl programmer should be able to trap all
exceptions, there is a technical problem in the case of fatal g_log()s
(such as g_error()) --- C code calling g_error() expects that the
program will abort(). Program state is undefined after trapping such
an error, and there's no way for the bindings to clean up and prevent
crashes. In many cases you'll get lucky with a longjmp() and only
have a leak, but it's simply not safe.
Would it be possible to add the above convenience function to the
standard
Gtk2 Perl distribution?
We try to avoid such additions in the name of API sanity. For
example, if gtk+ later added a method with the same name but slightly
different semantics, we would have a name clash, and would have to do
very ugly things (for both binders and users) to resolve that.
--
One, two, free, four, five, six, sebben, eight, nine, ten, elebben,
twull, fourteen, sickteen, sebbenteen, eightteen, elebbenteen,
fiffeen, elebbenteen!
-- Zella, aged three, counting to twenty.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]