Re: [Vala] Interfaces - why do they must have prerequisites?



On Sun, Dec 05, 2010 at 17:32:17 +0100, Aleksander Wabik wrote:
I'm having class Foo, that is _NOT_ inheriting Object, but it's still
a typed class, and it's implementing interface IFoo. This is (or used to
be) legal.

No, it is not and never was legal. Interfaces depend on runtime support
provided by GObject and therefore only classes derived from GLib.Object may
implement interfaces.


Hi Jan,

it was legal and in fact recent valac is still able to compile my other
app, that is using interfaces that do not have GLib.Object as a
prerequisite, and the class that implements these interfaces does not
inherit Object too. As far as I remember, it has always worked this
way, compact classes don't implement interfaces, but typed classes can
dothis even if they don't inherit from GLib.Object. 

I'm attaching a file that shows it (GPL v.2). There's no main() method,
but compiling it to C code (valac -C test.vala) works. This code is a
part of a bigger project and in the executable app it has always worked.
So obviously you don't have to inherit Object to be able to implement
interfaces.

best regards,
AW.

-- 
Mój klucz publiczny o identyfikatorze 1024D/E12C5A4C znajduje się na
serwerze hkp://keys.gnupg.net

My public key with signature 1024D/E12C5A4C is on the server
hkp://keys.gnupg.net

Attachment: test.vala
Description: Binary data

Attachment: signature.asc
Description: PGP signature



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