-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ownership model for streams is not clear. #7
Comments
The ownership of memory is not something specific to the wasi-http/wasi-io proposals, but rather defined by the Canonical ABI based purely on the types involved. For |
I was suggesting that the streams wit definition should add clarity in the comments about how this is expected to work. |
Improving documentation is a good idea, but I don't know if the Wit document is the right place since this ends up being for many guest/host languages, a bindings-internal detail (e.g., JS will simply see a JS array pop out). But perhaps this could be usefully generated as part of the ABI documentation or, perhaps better, in the generated C header comments. @sunfishcode was thinking about this too recently, so that we're not having to send folks to read Canonical ABI all the time. |
In garbage collected languages, the ownership is clearly not as important, but in non-gc languages like C it is a question that someone asks whenever they see a pointer as a return value. |
Even for explicitly-managed languages like C++/Rust, the ownership transfer should be made explicit in the return types of the generated bindings (e.g., a |
When reading from a stream, it seems that the list that is returned from a stream is owned by the caller, but that is not clearly spelled out in the documentation.
The text was updated successfully, but these errors were encountered: