The way mixins are done in IDL has changed syntax somewhat. Instead of having a [NoInterfaceObject] interface and an "implements" statement, the new setup looks like this:

  interface A {};

  interface mixin B {
    void somethingMixedIn();
  }

  A includes B;

In-tree IDL has been updated to the new syntax. Support for the old syntax has not been removed yet, but will be as soon as that patch is reviewed; please do not add new IDL using "implements".

The new setup is a little less featureful: mixins have no inheritance and cannot include other mixins. They _do_ support partials, so you can do:

  interface A {};
  interface mixin B {};
  partial interface mixin B {
    void somethingMixedIn();
  };
  A includes B;

A mixin and its partials have to in the same .webidl file, just like our existing rules for interfaces. This is not enforced yet, but will be soon. Similarly, the "A includes B" statement must be in the same .webidl file as the definition of interface A. This part _is_ enforced.

Mixins have somewhat restricted syntax compared to interfaces (e.g. do not allow mixing in constructors, getter/setter operations, iterable declarations, etc). This should not be a problem in practice, and certainly wasn't for anything we had in-tree.

-Boris
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to