-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stop exposing mixins; instead add them to their target interfaces #8929
Comments
Thank you for writing this up! I'm excited to begin making mixins more manageable. Overall, I think this is a good direction to go. Some initial thoughts and questions, which are mostly minor:
|
Thanks for the feedback, Daniel! 1.: Yes, 2a: main thread and worker global scopes: no matter how we treat mixins, real interfaces will be exposed to different contexts and so that remains (in theory, will investigate more). 2.: Yes, my current thinking is that BCD should disallow defining entries twice. 3.: Yes 4.: Yes, totally needs a data guideline. I'm opening a proof of concept PR that re-organizes a mixin. From there we can hash this out further and validate/invalidate the overall approach I'm proposing in this issue. |
I support the general approach, but defer to you all regarding the implementation. |
It's so simple, I'm wondering why no one has thought of it before. |
@foolip Can you comment if this approach would work with the tooling you maintain? |
I strongly support this flattening. Whether the entries are in However, @ddbeck's secret question is spot on, there is a complication we have to consider:
We could naively flatten these mixins and end up with It's an accident of how Web IDL works that the exposure set of interfaces like However, I think it would be smart to set |
Daniel:
Florian:
So, this is filed in #4200 (we don't just need to protect ourselves against duplicates with mixins but we should protect against duplicates generally). |
The consistency checker probably needs to get better, too: #9044 |
@Elchi3 for the PRs that actually demix interfaces, do you have a sense of how you want to be reviewed, with regard to discrepancies or validity? For example, for #9048 should I care that the versions in |
Yeah, good point. I've asked Philip to assist with bcd-collector automation to get to better data, but I've been focusing on re-organizing the data instead of doing the research. Verifying all remixed data is quite a bit of work, I'm afraid.
fwiw, often it is bug in the current data that these are the same. Many times things are exposed earlier to old school interfaces like Document and a lot later on interfaces like ShadowRoot, for example. Mixin data then does something and it is often wrong, so I think this isn't something to care about in all situations. |
Thanks! This sounds good and that's how I'm going to review these now. |
(Edited @foolip's burndown list to add links to open PRs. I hope that's OK!) |
Thanks for helping with this effort, @foolip. I appreciate it! |
Thanks @Elchi3! I don't plan to send any more PRs since you're already working on it, but I'd be happy to review them. |
With #10958 out, everything that now remains requires deciding how to deal with worker exposure. |
That's great news! Do we have a separate issue for that already? |
No, it's just all the unchecked boxes (except |
Well actually, |
But that instead runs into the events mess. I really can't claim it's going to be an improvement to have 3 entries for |
I think it would help to start new issues and spell out the concrete remaining data points and options we have for them. |
Existing issues cover everything that remains:
|
This is all done except for |
Amazing, I never thought we'd (almost) get rid of mixins :) |
It seems like there is largely consensus to hide mixins to the world of web developers for reasons discussed in #472 for BCD and in mdn/content#1940 for MDN docs.
@rachelandrew notes an authoring drawback when hiding mixins and documenting things directly on the interfaces, though:
I think this is a good point. So, how can we remove mixins and while keeping some authoring conveniences (i.e. avoiding large BCD files)? Luckily (and ironically) BCD supports mixing in data to a particular tree! We just haven't made a lot of use of that.
Right now we have
api/Element.json
and it is exposing its content as "api.Element.*
".We also added files like
api/AriaMixin.json
and exposed content as "api.AriaMixin.*
". This is not hiding the mixin but exposes it directly :(However, to hide mixins, we could have a file
AriaMixin-for-Element.json
and expose its content as "api.Element.*
" (we mix in data toElement
, ha!)For that to happen, the
AriaMixin-for-Element.json
file needs to start like this:Note the "Element" after "api". This will extend what is already defined in
api/Element.json
.To keep things clean, we can also move
AriaMixin-for-Element.json
toapi/mixins/AriaMixin-for-Element.json
, so that we know files in this folder extend other interfaces in the mainapi/
folder.If in the year 2525,
AriaMixin
is exposed toCyberElement
, we have a new compat story, and so we should haveapi/mixins/AriaMixin-for-CyberElement.json
and it will add data to the exposed APICyberElement
.Thoughts?
The text was updated successfully, but these errors were encountered: