Stream: wit-bindgen

Topic: Functions as parameters


view this post on Zulip Christoph Brewing (May 17 2023 at 14:18):

In the component model, Is it possible for a host to pass a function-handle to the guest in order to let the guest call that specific function?

My point is that I would like to avoid exposing the function explicitly in the .wit file. Ideally, the .wit would expose the signature/type of the function which may be called. However, browsing The wit format, I think, this is not possible.

Can anyone confirm my assumption?

Repository for design and specification of the Component Model - component-model/WIT.md at main · WebAssembly/component-model

view this post on Zulip Alex Crichton (May 17 2023 at 14:18):

That's correct, functions-as-values are not possible in the component model type language

view this post on Zulip Dan Gohman (May 17 2023 at 16:53):

There are some planned features which will be able to do something very similar though. When integrated-async streams are added, reading from a stream in one component that's being written to in another will have the effective behavior the reader calling a callback in the writer. And when component-imports are added, they'll provide an instantiation-time way to pass in code for a component to run.


Last updated: Dec 23 2024 at 12:05 UTC