4

Is there a way to inherit / extend interfaces in Djinni's DSL?

For example:

parent = interface +c {
  parentMethod();
}

child1 = interface +c {
  childMethod1();
}

child2 = interface +c {
  childMethod2();
}

I want to inherit child1 and child2 from parent.

Eiko
  • 25,601
  • 15
  • 56
  • 71
Benny
  • 133
  • 8

1 Answers1

6

There's no interface inheritance in Djinni currently. It's not because we're opposed to it (pull requests welcome!), but simply because it hasn't been a need in Dropbox's development. You can probably get something close to what you need with some explicit methods. E.g. add a asParentInterface() method to your child objects. At the C++ layer you could choose to just return "this" cast to another type, and your impl object would multiply inherit from Djinni base classes. In the app languages you'd see multiple distinct proxy objects on the same underlying object.

Andrew
  • 1,073
  • 7
  • 6