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

Feature: void return #218

Closed
edef1c opened this issue Apr 25, 2013 · 6 comments
Closed

Feature: void return #218

edef1c opened this issue Apr 25, 2013 · 6 comments

Comments

@edef1c
Copy link

edef1c commented Apr 25, 2013

A void return a la JS's return void EXPRESSION would rock. Maybe !return EXPRESSION or return! EXPRESSION.

@vendethiel
Copy link
Contributor

something like EXPRESSION; return ?

@satyr
Copy link
Owner

satyr commented Apr 25, 2013

EXPRESSION; return ?

This, or if you must: return void expression

@satyr satyr closed this as completed Apr 25, 2013
@edef1c
Copy link
Author

edef1c commented Apr 26, 2013

That works, though not quite idiomatic. I do if (cond) return void expr a lot in JS, for short-circuit logic.
return! expr if cond would be awesome.

@vendethiel
Copy link
Contributor

That's actually a more common patrern than I first thought, reading node code. if err then cb err; return is what I'd use (return void expr gets aci => return void, expr; and I'm not sure I'd like to see more hushing syntax).

@edef1c
Copy link
Author

edef1c commented Apr 27, 2013

return cb err if err is very common, along with a variety of similar async dispatches.
return! expr could compile to expr; return (return void is the best we can do when writing JS straight, but we have the opportunity to improve here)

@satyr
Copy link
Owner

satyr commented Apr 27, 2013

Hmph. True that it is another case forced more verbose than JS.

Options:

  1. Reuse the hushing analogy as proposed: !return (and not return)
  2. Treat return void (currently useless being the same as just return) as one operator.

@satyr satyr reopened this Apr 27, 2013
vendethiel added a commit to vendethiel/coco that referenced this issue Nov 14, 2017
@edef1c edef1c closed this as completed Apr 30, 2018
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

3 participants