[Vala] Implement abstract interface method in interface



Hi list,

I was planning to implement a family of GTK controls that provide
different views on the same information in the following fashion:

* a UI-agnostic interface defining the application-facing API
* a UI-agnostic model that implements the common functionality.
* view controller classes that round the whole thing off and
  display the user interface.

The view controller classes of course extend some Gtk Widget, but I'd
like to avoid that fact being visible in the model, so, since Vala
doesn't support full multiple inheritance, I thought I'd implement the
model as a mix-in interface.

However, it looks like it's not possible to implement abstract methods
defined in other interfaces within an interface:

$ cat mixin_test.vala
interface IFoo
{
    public abstract void foo ();
    public abstract void bar ();
}

interface IBar : IFoo
{
    public virtual void bar ()
    {
    }
}

class Baz : IBar, IFoo
{
    public void foo ()
    {
    }
}


void main ()
{
}

$ valac-0.18 mixin_test.vala
mixin_test.vala:14.1-14.22: error: `Baz' does not implement interface
method `IFoo.bar'
class Baz : IBar, IFoo
^^^^^^^^^^^^^^^^^^^^^^
Compilation failed: 1 error(s), 0 warning(s)


Firstly, is there something I'm missing? If not, is this  simply a
limitation in the Vala compiler, or is what I'm trying to do
fundamentally impossible within the GObject type system?

Thanks
Thomas



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