>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,
I think I've found the difference that causes this bug to reproduce or
not. In my whole program where it's not reproductible, I have never
declared interface instance as a local object (IFoo sth in the
function body); I create objects of class Foo, and assign them to
references of type Foo.
The interface is used in functions: function take argument of
interface type IFoo. It works! But if I try to create a reference of
interface type IFoo, error occurs. The demonstration code:
//-------- test.vala --------
namespace Test
{
public interface IFoo
{
public abstract bool run();
}
public class Foo : IFoo
{
public virtual bool run()
{
return true;
}
}
public static bool test(IFoo ifoo)
{
return ifoo.run();
}
public static void main()
{
//IFoo ifoo = new Foo();
Foo ifoo = new Foo();
test(ifoo);
return;
}
}
//------ end test.vala ------
This code will compile fine. But if I uncomment the commented line, and
comment the next one, it SHOULD compile fine too, but it fails with the
same error:
test.vala:23.3-23.6: error: missing class prerequisite for interface
`Test.IFoo', add GLib.Object to interface declaration if unsure
IFoo ifoo = new Foo();
^^^^
So... it is a bug, right?
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
signature.asc
Description: PGP signature
_______________________________________________ vala-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/vala-list
