Hello,
                في ن، 06-12-2010 عند 01:25 +0100 ، كتب Aleksander Wabik:
> As classes not inheriting from Object have different ref and unref
> functions (Foo will have foo_ref, and foo_unref, Bar will have bar_ref
> and bar_unref), if an object is referenced by the reference of interface
> type, there's no possibility to ref and unref this object unless
> knowing what ref and unref functions to use! This may be the cause why
> creating references of interface type fails, and passing interface type
> references to functions do not fail (there's no ref then).
Yes, that's exactly the problem.

> This is a serious flaw to the object system IMO. It means, that there's
> *no way* of having two classes that do not have common ancestor but
> implement the same interface. Possible ways to solve this problem:
What's exactly your problem with having common ancestor? AFAIK, every
type system out there requires all of your objects (whether they
implement an interface or not) to have a common ancestor. So why Vala's
"all objects implementing a given interface must have a common ancestor"
a problem?

And it's recommended to always inherit from GLib.Object unless the
performance gain is real (you're creating really many objects), and even
then creating a light base class for your app's classes to inherit from
wouldn't have much more overhead than implementing an interface in the
first place.

HTH,
Abderrahim

_______________________________________________
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to