Skip to content
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

Remove named multi-return from function types (for now at least) #368

Merged
merged 1 commit into from
Jul 12, 2024

Conversation

lukewagner
Copy link
Member

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 or record (almost always wrapped in a result). I think this means we can expect to see
an 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.)

Copy link
Contributor

@Mossaka Mossaka left a 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

@lukewagner
Copy link
Member Author

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).

@lukewagner lukewagner merged commit cdad9c3 into main Jul 12, 2024
2 checks passed
@lukewagner lukewagner deleted the rm-multi-return branch July 12, 2024 16:31
alexcrichton added a commit to alexcrichton/wasm-tools that referenced this pull request Jul 12, 2024
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.
github-merge-queue bot pushed a commit to bytecodealliance/wasm-tools that referenced this pull request Jul 15, 2024
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.
@alexcrichton
Copy link
Collaborator

This change is going to be shipped with Wasmtime 24, to be released August 20, as part of the update in bytecodealliance/wasmtime#8965

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants