examples: add component model example#7759
Conversation
1bf82e5 to
2c38776
Compare
alexcrichton
left a comment
There was a problem hiding this comment.
Thanks for this!
I'm somewhat of two minds on this. On one hand this example showcases a lot of downsides to the unsupported nature of the component model in languages. For example embeddings may not always embed wit-component itself and turn core wasm into components on-the-fly. Additionally this probably won't work for many "real world" use cases in the sense that WASI isn't handled here. That would require tweaks to both the build process and the embedder. Finaly the wasm32-unknown-unknown target, rarely used off the web, is used here (for simplicity of course, which makes sense)
On the other hand this showcases a concrete working example which is something folks can base work on. In that sense it's great to have! Given the number of moving parts in the component model being able to start somewhere is definitely valuable.
I'd probably lean towards landing this, although perhaps with a few more comments with respect to WASI and usage. Could you add a comment indicating that wasm32-unknown-unknown is used for simplicity here and additionally indicate that the usage of wit-component in embeddings is done for the purposes of this example and otherwise may not be expected in all host embeddings of Wasmtime?
2c38776 to
d4106c9
Compare
|
Thanks for the review! I ended up submitting this because I wanted to:
I thought the first use case was something others wanted to do, so I ended up creating this. I whole heartedly agree with your comments and have updated the PR. |
Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
d4106c9 to
060a34f
Compare
As part of my journey on learning how the component model works, I realized there is no example in wasmtime, so I figured it'd be useful to add a simple example of guest and host calls.