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

Allow “else” in “do” #188

Open
evincarofautumn opened this issue Jun 30, 2017 · 0 comments
Open

Allow “else” in “do” #188

evincarofautumn opened this issue Jun 30, 2017 · 0 comments

Comments

@evincarofautumn
Copy link
Owner

Currently, do (f) { x } is desugared to { x } f, that is, it lets you use a combinator like a flow control construct:

xs do (each):
  (* 42) say

I figure it would be useful for success/error callbacks in async code if a do block allowed an optional else:

do (http_get) -> result:
  ...
else -> error:
  ...

So do (f) { x } else { y } would desugar to { x } { y } f or maybe { y } { x } f if that turns out to work well with more functions.

I’m not sure if this needs an equivalent to elif (eldo?) for chaining multiple doelse together. It seems logical but I don’t have a specific use case in mind.

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

1 participant