Re: [Vala] Bug 666728 - critical warning in libgee



On Thu, Jan 5, 2012 at 10:40 AM, Ryan Lortie <desrt desrt ca> wrote:
hi Maciej,

Thanks for bringing up this topic.  I'm not exactly sure what the proper
way forward is, but you raise some interesting possibilities.

On Thu, 2012-01-05 at 01:32 +0100, Maciej Marcin Piechotka wrote:
I don't think I can fix on libgee side without breaking API/ABI (at
least I don't see it). I believe that because currently various GNOME
applications depends on libgee it means that bug effectively breaks
GNOME (by breaking for example gnome-shell or empathy).

I talked to Jürg a bit about this problem and I think he decided that
the appropriate thing to do would be to modify Vala to prevent Gee from
doing this in the first place.

 - Treating g_object_interface_install_property as override property if
interface have prerequisite

I think this wouldn't help.  The problem comes from the fact that two
separate interfaces are defining a property with the same name and
different types (so far so good) and then a class tries to implement
both interfaces (one directly and one by inheritance).  Boom.

What we could do is to try to step up the intelligence in GObject about
*which* property to override to pick the more-compatible type.  I resist
this because it's not simple and because in the event that you have two
properties with the same name, why should we arbitrarily pick one over
the other at all?  Even if the types are compatible, we still have
(admittedly small) questions about things like which description string
we want to end up with.  That might be a small practical concern, but it
gives me a distinct feeling of "this is icky...".

Strongly agree with Ryan here, lets please refrain from allowing subclasses
to implement interfaces with conflicting property names at all.

Critical warnings should be fired, perhaps g_object_class_add_interface()
should simply fail in the case that a property name clashes with a class
property or another interface property (is this not already the case anyway ?).

Otherwise it becomes very easy to introduce undefined/random behavior
from apis like g_object_set/get() (or g_object_class_list_properties()... etc)

Cheers,
               -Tristan


I think we should possibly consider being *more* strict in this area: if
there are two possible properties of the same name that you could be
overriding then g_object_class_override_property() should probably fail.

 - Change Vala to use g_object_class_install_property(s) instead of
g_object_class_override_property.

I think this would be pretty reasonable.  Vala has enough information to
be able to pick the correct information to register the property with,
from scratch.  It could also give a meaningful compile time error if
it's not possible to reconcile the types in a way that works with the
access flags of each of the properties.

 - Change error into warning, remove it from libgee 0.7/0.8 and change
back into error when the old software die.

It's just a critical now, so nothing should die.

I suppose we could downgrade that to a warning if you're worried about
people running with fatal criticals.

Cheers

_______________________________________________
gtk-devel-list mailing list
gtk-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list



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