-
Notifications
You must be signed in to change notification settings - Fork 92
Remove named multi-return from function types (for now at least) #368
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will simplify the specification a lot. Thanks
b9ea529
to
4c0cbf7
Compare
Ok, since noone seems to be using multi-return afaics and this is a conservative change we can always relax later (via #356), I'll go ahead and merge now (which may shake out more use cases, which will be useful data). |
This commit is an implementation of WebAssembly/component-model#368 in this repository. The intention here is along the lines of a few other recent restrictions which is to avoid outright removing support and instead stage the changes a bit. To that end a new feature flag is added and multi-return functions are now gated behind this feature flag. Tests are updated to avoid using it and otherwise the actual removal of supporting code is deferred to a later date.
This commit is an implementation of WebAssembly/component-model#368 in this repository. The intention here is along the lines of a few other recent restrictions which is to avoid outright removing support and instead stage the changes a bit. To that end a new feature flag is added and multi-return functions are now gated behind this feature flag. Tests are updated to avoid using it and otherwise the actual removal of supporting code is deferred to a later date.
This change is going to be shipped with Wasmtime 24, to be released August 20, as part of the update in bytecodealliance/wasmtime#8965 |
This was a bit more involved due to a big change in the way function return types are handled. The orginal change was done in WebAssembly/component-model#368 and put initially put behind a feature flag in bytecodealliance/wasm-tools#1670. In 0.226.0 version of wasmparser this feature flag was removed simplify the return results. This in turn simplifies the handling of the results here as well. Signed-off-by: James Sturtevant <[email protected]>
This was a bit more involved due to a big change in the way function return types are handled. The orginal change was done in WebAssembly/component-model#368 and put initially put behind a feature flag in bytecodealliance/wasm-tools#1670. In 0.226.0 version of wasmparser this feature flag was removed simplify the return results. This in turn simplifies the handling of the results here as well. Signed-off-by: James Sturtevant <[email protected]>
This was a bit more involved due to a big change in the way function return types are handled. The orginal change was done in WebAssembly/component-model#368 and put initially put behind a feature flag in bytecodealliance/wasm-tools#1670. In 0.226.0 version of wasmparser this feature flag was removed simplify the return results. This in turn simplifies the handling of the results here as well. Signed-off-by: James Sturtevant <[email protected]>
This was a bit more involved due to a big change in the way function return types are handled. The orginal change was done in WebAssembly/component-model#368 and put initially put behind a feature flag in bytecodealliance/wasm-tools#1670. In 0.226.0 version of wasmparser this feature flag was removed simplify the return results. This in turn simplifies the handling of the results here as well. Signed-off-by: James Sturtevant <[email protected]>
This was a bit more involved due to a big change in the way function return types are handled. The orginal change was done in WebAssembly/component-model#368 and put initially put behind a feature flag in bytecodealliance/wasm-tools#1670. In 0.226.0 version of wasmparser this feature flag was removed simplify the return results. This in turn simplifies the handling of the results here as well. Signed-off-by: James Sturtevant <[email protected]>
This was a bit more involved due to a big change in the way function return types are handled. The orginal change was done in WebAssembly/component-model#368 and put initially put behind a feature flag in bytecodealliance/wasm-tools#1670. In 0.226.0 version of wasmparser this feature flag was removed simplify the return results. This in turn simplifies the handling of the results here as well. Signed-off-by: James Sturtevant <[email protected]>
This was a bit more involved due to a big change in the way function return types are handled. The orginal change was done in WebAssembly/component-model#368 and put initially put behind a feature flag in bytecodealliance/wasm-tools#1670. In 0.226.0 version of wasmparser this feature flag was removed simplify the return results. This in turn simplifies the handling of the results here as well. Signed-off-by: James Sturtevant <[email protected]>
This was a bit more involved due to a big change in the way function return types are handled. The orginal change was done in WebAssembly/component-model#368 and put initially put behind a feature flag in bytecodealliance/wasm-tools#1670. In 0.226.0 version of wasmparser this feature flag was removed simplify the return results. This in turn simplifies the handling of the results here as well. Signed-off-by: James Sturtevant <[email protected]>
Currently function types are slightly asymmetric with results having an extra single-unnamed-result option. As #356 points out, we could make params and results fully symmetric by saying that both could either be a list of all-named- or all-unnamed types. I think that topic requires some more discussion to motivate and understand the implications for bindings generators in various languages.
In the meantime, though, I don't think anyone uses or even knows about named multi-return -- the much more common thing to do is to return a
tuple
orrecord
(almost always wrapped in aresult
). I think this means we can expect to seean ad hoc mix of multi-return and
tuple
/record
in practice which seems like needless inconsistency (and wasted time arguing over what if any convention there should be). It also seems like this path will be either unimplemented or untested in current bindings generators, which bodes poorly if anyone ever does decide to use this feature.Thus, this PR proposes that, at least until we decide to go for full symmetry, we lean into the asymmetry (which is already present) and disable this additional case of named multi-return that (afaik) noone is using. If however anyone is using and appreciating named multi-return, I'd be very interested to hear about it! (I'll leave this PR open for a while to collect feedback.)