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

Add runtime instantiation to component model #423

Open
pothos opened this issue Apr 27, 2024 · 2 comments
Open

Add runtime instantiation to component model #423

pothos opened this issue Apr 27, 2024 · 2 comments

Comments

@pothos
Copy link

pothos commented Apr 27, 2024

Is there anyone already working on a draft for adding runtime instantiation to the component model?

Runtime instantiation means that a component can dynamically instantiate another component given its binary representation, and then invoke them. This is needed to have something similar to exec, where the number of imported instances and even the module code itself is not statically predefined but evolves programmatically. Currently one could define a custom protocol between the runtime and a component to have a similar effect. Use cases are flexible reusing of modules, runtime generation or fetching of modules (network or from disk), and a small demo program you could think of is a wasm component shell or wac REPL that itself runs as wasm component.

A few links in Luke's answer here: WebAssembly/wasi-cli#25

@lukewagner
Copy link
Member

That's a good question, but perhaps the better place to ask it is https://github.com/webassembly/component-model.

@sunfishcode sunfishcode transferred this issue from WebAssembly/design Dec 3, 2024
@lukewagner
Copy link
Member

(Oh haha, I was confused by my above comment before seeing that Dan transferred it :P)

I'm not working on a draft yet, but once 0.3-async is closed out, this is one of the last significant feature I am quite keen to add to the CM for a 1.0 MVP, because I totally agree with those use cases you mention being important.

The rough shape of the feature here is a new canon built-in that allows "resourceifying" any component (nested or imported) to produce:

  1. a new resource type representing instances of that component
  2. a new function that runtime-instantiates that component, returning an owned handle of type (1)
  3. for each export of that component, a function that prepends to the original parameters a borrowed handle of type (1)

But lots more work to turn this idea into a real draft proposal; I'm sorry there's not more worked out yet.

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

No branches or pull requests

2 participants