Thanks, yes, I'm asking about the wasm/wasi target. There are several cases when this would have been useful.
For example, I'm experimenting with a system that consists of several Wasm modules and all interaction between them has to be orchestrated through the host manually (until the component model is more widely supported). One issue with that is memory consumption. For instance when a large string is "piped" through several modules for processing, a lot of copies have to be made - at the very least there is a copy one it is passed from the host to the guest through the linear memory, then a copy to deserialize it into a byte array, then a copy to decode that into a string, then a similar process to return the updated result to a host. Since linear memory size can't be reduced, in one iteration all modules linear memories grow substantially and total memory consumption becomes unacceptable.
I'm considering a number of options for dealing with - streaming data through a buffer (doesn't solve the issue in a case when the whole string has to be constructed in the guest memory eventually), using preopened files (sandboxing guarantees for this are weak for a number of runtimes at the moment).
One other option is not to pass the data at all and instead pass
externref
and define host functions for working with them so that the data never leaves the host while the guest can operate on it anyway. This wouldn't work for all cases but still can be useful in some.
I guess externref can be emulated but it would have been more convenient if they were available directly.