Skip to content
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

Remove support for handles and resources #346

Merged
merged 3 commits into from
Oct 5, 2022

Conversation

alexcrichton
Copy link
Member

This commit removes all support for the resource and Handle types from the AST of wit-parser and all related support in all code generators. The motivation for this commit is that wit-bindgen is on the cusp of actually being able to work with components: producing a component from guest output and consuming components in host generators. More detail about this is in #314. With components as an intermediate format, however, there is no way to encode resources since they are not part of the component model proposal yet.

All is not lost for handles and resources, though. The official design for handles and resources is being worked on upstream in the component model repository itself at this time and once added all of this support will be re-added to wit-bindgen. In the meantime though I personally think that the best way forward is to remove the interim support for a few reasons:

  • Primarily it unblocks progress at this time towards fully integrating components and the wit-bindgen generators. The requirement to run existing tests that use handles would mean that no host generator could actually switch to components and/or modes for today's core-wasm-lookalike would need to be preserved.

  • Otherwise though the semantics of the current handles are basically invented out of thin air by myself and were never really formally specified, debated, or designed deliberately. I grafted witx-style handles into wit-component and added features as necessary over time, but it seems highly unlikely that the handles designed as part of the component model will be the ones that wit-bindgen currently supports. This inevitably means that a new system would need new code anyway and would likely result in removal regardless.

As usual git always has the history of handles and this all may come back in one shape or another if only slightly tweaked. I'm confident in our history spelunking abilities, though, so I don't feel that keeping support in the repository is necessary for this purpose.

This commit removes all support for the `resource` and `Handle` types
from the AST of `wit-parser` and all related support in all code
generators. The motivation for this commit is that `wit-bindgen` is on
the cusp of actually being able to work with components: producing a
component from guest output and consuming components in host generators.
More detail about this is in bytecodealliance#314. With components as an intermediate
format, however, there is no way to encode resources since they are not
part of the component model proposal yet.

All is not lost for handles and resources, though. The official design
for handles and resources is being worked on upstream in the component
model repository itself at this time and once added all of this support
will be re-added to `wit-bindgen`. In the meantime though I personally
think that the best way forward is to remove the interim support for a
few reasons:

* Primarily it unblocks progress at this time towards fully integrating
  components and the `wit-bindgen` generators. The requirement to run
  existing tests that use handles would mean that no host generator
  could actually switch to components and/or modes for today's
  core-wasm-lookalike would need to be preserved.

* Otherwise though the semantics of the current handles are basically
  invented out of thin air by myself and were never really formally
  specified, debated, or designed deliberately. I grafted `witx`-style
  handles into `wit-component` and added features as necessary over
  time, but it seems highly unlikely that the handles designed as part
  of the component model will be the ones that `wit-bindgen` currently
  supports. This inevitably means that a new system would need new code
  anyway and would likely result in removal regardless.

As usual git always has the history of handles and this all may come
back in one shape or another if only slightly tweaked. I'm confident in
our history spelunking abilities, though, so I don't feel that keeping
support in the repository is necessary for this purpose.
@alexcrichton alexcrichton merged commit 25596c7 into bytecodealliance:main Oct 5, 2022
@alexcrichton alexcrichton deleted the remove-handles branch October 5, 2022 14:34
kateinoigakukun added a commit to ruby/ruby.wasm that referenced this pull request May 21, 2023
because handles and resources support were already removed in the main
branch of wit-bindgen
bytecodealliance/wit-bindgen#346
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants