Add support for WebIDL mixins
Categories
(Core :: DOM: Bindings (WebIDL), enhancement, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox70 | --- | fixed |
People
(Reporter: tobie.langel, Assigned: saschanaz)
References
(Blocks 1 open bug)
Details
(Keywords: dev-doc-complete)
Attachments
(1 file)
![]() |
||
Comment 1•7 years ago
|
||
Reporter | ||
Comment 2•7 years ago
|
||
![]() |
||
Comment 3•7 years ago
|
||
Reporter | ||
Comment 4•7 years ago
|
||
![]() |
||
Comment 5•7 years ago
|
||
Reporter | ||
Comment 6•7 years ago
|
||
Updated•7 years ago
|
Updated•7 years ago
|
Comment 7•7 years ago
|
||
Updated•6 years ago
|
![]() |
||
Comment 8•6 years ago
|
||
OK, so in terms of what needs to be done here (more or less broken down by changeset if I were doing this):
- Decide whether mixins should basically use the same data structure as
IDLInterfaceOrNamespace
or something simpler. I suspect something simpler would be better, because we don't actually want most of the relevant work ofIDLInterfaceOrNamespace.finish
to happen on mixins: we just want to pull their members into the things including them and do all the validation and whatnot after that. I also suspect interface and namespace mixins can use basically the same data structure with just a namespace-or-interface boolean flag to make sure people don't include an interface mixin in a namespace or vice versa. Plus maybe whatever make-it-static-my-default behavior namespace mixins need. But it's worth looking through the spec to see what operations need to be supported on mixins and then deciding how to refactor the class hierarchy based on that. Implement the actual data structure for mixins and whatever work partial mixins will need. - Implement the behavior of the
includes
directive, in terms of copying members from a mixin to the including interface or namespace and whatever other work or validation has to happen in the process. - Modify the grammar to allow mixins (and start creating the objects from step 1 as needed) but not remove
implements
yet. - Switch over all in-tree uses of
implements
to useincludes
with mixins. This might be multiple changesets, especially if some of the changes are nontrivial (e.g. the webgl ones, because the webgl spec has invalid IDL now that it's using mixins...) - Remove
implements
from the grammar. - Remove the handling of
implements
in terms of copying things over to the implementing interface. - Various simplifications, possibly in multiple changsets, to remove concepts like consequential interfaces, etc, etc.
Assignee | ||
Comment 9•6 years ago
|
||
I also suspect interface and namespace mixins can use basically the same data structure with just a namespace-or-interface boolean flag to make sure people don't include an interface mixin in a namespace or vice versa.
Do we have namespace mixins? I skimmed the code and it seems IDLImplementsStatement throws if it's used for any non-interfaces, and AFAIK the spec also does not define mixins for namespace.
![]() |
||
Comment 10•6 years ago
|
||
Do we have namespace mixins?
Looks like no. At some point there was discussion about having them in the spec, but I guess that got deferred or nixed.
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Comment 11•6 years ago
|
||
Add IDLInterfaceMixin with a new superclass shared with existing IDLInterfaceOrNamespace.
![]() |
||
Updated•6 years ago
|
![]() |
||
Comment 12•6 years ago
|
||
I filed bug 1574195 and bug 1574201 as followups to this.
Comment 13•6 years ago
|
||
Comment 14•6 years ago
|
||
bugherder |
Comment 15•5 years ago
|
||
Marking this as dev-doc-complete; I already make the appropriate changes to https://developer.mozilla.org/en-US/docs/MDN/Contribute/Howto/Write_an_API_reference/Information_contained_in_a_WebIDL_file#Mixins after :bzbarsky announced it on dev-platform.
I'm not going to add this to the Fx70 rel notes, as it is not really interesting to web devs.
Description
•