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?
That's correct, functions-as-values are not possible in the component model type language
There are some planned features which will be able to do something very similar though. When integrated-async stream
s 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