Re: About gsettings aborting on unkown schemas



Hi,

Man, how many times has this thread happened? At least fifty.

On Fri, May 27, 2011 at 10:57 AM, Shaun McCance <shaunm gnome org> wrote:
> try:
>    load_some_extension()
> except:
>    warn("This extension sucks. I'm disabling it and moving on.")
>
> Of course, GLib is C. We don't have exceptions. We have GError,
> which is a decent foundation for exceptions in language bindings.
> But if we don't use it, then languages that could otherwise do
> the right thing are screwed.

This is the core thing. People who expect no g_error/abort are used to
languages with exceptions.

The thing that's different about C is that an "exception" (think
GError) changes the function signature of that function... _and_ *all
callers* in any library or app!

One of the very foundational design decisions of GLib, back in the
90s, was to not have an error code from every single function.
(Contrast with some other utility libraries.) And this decision has
been continued in GTK+ and all the other family of GLib-based
libraries. Some might like to change it, but people, it's too late to
paint this bikeshed another color with thousands and thousands of
existing API calls relying on it. It does, you have to admit, make the
C API a lot nicer.

The core principle that allows most functions to "always succeed" is
that programming bugs are not "thrown," they just terminate the
program.

Config schemas that contain type checking and default values are part
of the program; the program is either incorrect, or redundant in a way
likely to create bugs, without the schemas. If schemas were just docs
or something, it would be a different situation.

If you really want to "handle" this, make it impossible to be missing
the schema, by embedding the schema in the binary at compile time,
perhaps. I don't know.

Havoc


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