There is the following observation related to imported interfaces and types which I do not understand:
Given the following interface/world:
interface nicestuffhere {
my-function: func(v0: list<u8>) -> float64
}
default world whatever {
import sth: self.nicestuffhere
}
When the implementation wants to call function my-function
Then its parameter v0
has to be of type &[u8]
where my expectation was to call a Vec<u8>
. I thought so based on the assumption that among module/component boundaries data is exchanged in a shared nothing style which implies an exchange by value (in my head).
My understanding is obviously wrong but in which way?
The string is copied into the callee's linear memory.
Another way of thinking about it is that passing a Vec
isn't passing the string data by value, its passing a (smart) pointer to the string data.
makes sense, thank you
Last updated: Dec 23 2024 at 12:05 UTC