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

return? #164

Closed
kripken opened this issue Nov 5, 2015 · 12 comments
Closed

return? #164

kripken opened this issue Nov 5, 2015 · 12 comments

Comments

@kripken
Copy link
Member

kripken commented Nov 5, 2015

The exports.wast testcase has a "return" opcode. Is that part of the spec?

@kg
Copy link
Contributor

kg commented Nov 6, 2015

Hm, it's not in AstSemantics. I think it was before - but there have also been discussions of removing return in favor of break-with-value, so maybe that was finalized?

@drom
Copy link

drom commented Nov 6, 2015

@kg
Copy link
Contributor

kg commented Nov 6, 2015

Yeah, there it is. I guess GitHub repository search doesn't actually work. :|

@kripken
Copy link
Member Author

kripken commented Nov 6, 2015

Ah, I thought a previous discussion said we didn't have it anymore, I must have misunderstood. I guess we were just considering removing it.

@titzer
Copy link
Contributor

titzer commented Nov 6, 2015

I actually went all the way and removed it from v8-native, since
break-with-value subsumes it. However, in terms of usability, return is
really nice, so I kind of miss it.

On Fri, Nov 6, 2015 at 8:49 AM, Alon Zakai [email protected] wrote:

Ah, I thought a previous discussion said we didn't have it anymore, I must
have misunderstood. I guess we were just considering removing it.


Reply to this email directly or view it on GitHub
#164 (comment).

@jcbeyler
Copy link

Forget usability and say "readability". I have currently left it in my wasm-to-llvm prototype because I find it so much easier to read :)

@titzer
Copy link
Contributor

titzer commented Nov 11, 2015

It is also still in the design repo, so I plan to add it back to v8-native.

On Tue, Nov 10, 2015 at 6:21 PM, jcbeyler [email protected] wrote:

Forget usability and say "readability". I have currently left it in my
wasm-to-llvm prototype because I find it so much easier to read :)


Reply to this email directly or view it on GitHub
#164 (comment).

@sunfishcode
Copy link
Member

I don't have an opinion yet, but a few observations:

It's in the design repo, but only because it predates statements=expressions, and the design hasn't been updated for that change in general.

Return is non-compositional, for what that's worth.

If the goal is just to make code more readable, an only slightly weaker effect could be achieved by using the existing label name syntax sugar and naming the return label "$return". Disassemblers could do this automatically if they wanted.

@titzer
Copy link
Contributor

titzer commented Nov 11, 2015

My experience has been that expressing break as return from the outermost
block has been quite tricky. It'd be less of a burden if we were to specify
that every function body is wrapped in an implicit block from which one can
break, but it's still uncomfortably error-prone. Return is
non-compositional across inlining, but still composable within a function
body (i.e. moving an AST that contains a return within a function doesn't
require updating the return). Viewed as labels, return implicitly binds to
the topmost label of the function, and thus is not a free label variable.

On Wed, Nov 11, 2015 at 12:40 AM, Dan Gohman [email protected]
wrote:

I don't have an opinion yet, but a few observations:

It's in the design repo, but only because it predates
statements=expressions, and the design hasn't been updated for that change
in general.

Return is non-compositional, for what that's worth.

If the goal is just to make code more readable, an only slightly weaker
effect could be achieved by using the existing label name syntax sugar and
naming the return label "$return". Disassemblers could do this
automatically if they wantef


Reply to this email directly or view it on GitHub
#164 (comment).

@rossberg
Copy link
Member

Return stays, closing.

@sunfishcode
Copy link
Member

For the record, I don't feel this is really settled yet; it's just something we're not really ready to explore while we have so many open questions about the nature of the text format(s).

@rossberg
Copy link
Member

@sunfishcode, fair enough. I interpret this specific bug as being about the divergence between spec repo and design doc, which seems resolved for the time being.

ngzhian added a commit to ngzhian/spec that referenced this issue Nov 4, 2021
Merge upstream changes and small fix for S128
dhil pushed a commit to dhil/webassembly-spec that referenced this issue Oct 3, 2023
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

No branches or pull requests

7 participants