swiftwasm / WebAPIKit

Access the DOM and other Web APIs from Swift! (Very much a WIP)
MIT License
61 stars 8 forks source link

Try splitting modules #30

Open kateinoigakukun opened 2 years ago

kateinoigakukun commented 2 years ago

One of the difficulties of splitting modules is that webidl files make circular references. For example, dom.idl and html.idl reference each other.

Here is my basic idea to solve the problem without tuning idl files by hands:

  1. Analyze all *.idl files at once
  2. Build a dependency graph against type symbols
  3. Compute SCC to merge only circularly referenced symbols across idl files, then translate it into DAG
  4. Compact the graph by merging by source idl file names as much as possible.

The DAG looks like: dag

MaxDesiatov commented 2 years ago

I'm going to put my PRs on hold until you're done with this one, again sorry about the conflicts 😅

kateinoigakukun commented 2 years ago

There was a lot more work and issues than I originally envisioned, so this PR is not meant to be merged in a near day. This is just for call for advice hehe. So this doesn't block the merge of other PRs