Archived

This forum has been archived. Please start a new discussion on GitHub.

Forward referencing interfaces in slice

I have two interfaces in a slice definition file where i basically want to do this:

interface A {
register(B* proxy);
}

interface B {
register(A* proxy);
}

Obviously I get an error in interface A, as B is not defined at that time. However because I'm dealing with interfaces and not classes it is appearently impossible to make a predefinition of B.

It might be feasible to translate the setup into classes (Where I could make the forward definition), but it would be impractical as I'm using multiple inheritance, so I would very much like to know if there is a smarter solution.

Comments

  • Of course Slice supports forward declarations of interfaces:

    interface B;

    interface A {
    register(B* proxy);
    }

    interface B {
    register(A* proxy);
    }
  • Yes, so it does.

    I got an error the first time I tried it, that said something about 'B already defined' or something along those lines, but it must have been caused by something else.

    Sorry about that.