WebAssembly / interface-types

Other
641 stars 57 forks source link

Rebase this proposal on top of Module Linking #122

Closed lukewagner closed 3 years ago

lukewagner commented 3 years ago

In the current explainer, the mechanism by which (@interface func)s and (@interface implement)s link with the core module's imports and exports is rather magical and limited. This linking can be explained and generalized in terms of the concepts introduced by Module Linking. Doing so also makes it much clearer what exactly is imported and exported in the final adapted module: it's the same story for when one module nests another.

This "rebase" also pulls in a ton of discussion and iteration with @fgmccabe and @eqrion about the proposal in general. In particular:

Lastly, use cases and additional requirements are updated to reflect our updated understanding. Happy to get feedback on this new draft!

mijamo commented 3 years ago

I just want to say that I read the full overview in this pull request and I love it. Until now interface types were not super clear to me, I understood the basic idea but not the instructions nor the architecture, in particular with non-string types.

The current explanation is well explained and seems to cover most of the needs I had identified for such a feature. Examples are clear and relevant, so congratulations for such a wonderful job!

For me the part that really made it click was the list lifting explanation and example, this is where I suddenly understood the whole laziness and uniqueness problem, because it relates to traditionnal iterator problems. I think that actually the possibility to use list for iterators is very interesting and could be mentionned more prominently rather than being just a side note.

All in all it just sounds great and I can't wait playing with it!

taralx commented 3 years ago

Rendered version for the lazy like me.

taralx commented 3 years ago
  (adapter_func (export "run")
    call $core.$run
  )

Can this be an exported alias instead?

lukewagner commented 3 years ago

@mijamo Thanks! I added two sentences to call out the iterator use cases a bit more prominently.

@taralx That's right. I added a note to make this a bit more clear.

zakbaig commented 3 years ago

@lukewagner Are we close to a phase 2 stage with this PR?!

lukewagner commented 3 years ago

@zakbaig We're closer, but still several TODOs left, I believe.

lukewagner commented 3 years ago

In the last commit, I merged and rewrote the last two use cases into a single one that I think more clearly states the high-level use case of "maximizing reuse" and how the proposals helps achieve that. Credit to @fgmccabe for the suggestions on how this could be improved.

lukewagner commented 3 years ago

Thanks for the review!