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

if let support #11

Closed
thautwarm opened this issue Aug 18, 2018 · 6 comments
Closed

if let support #11

thautwarm opened this issue Aug 18, 2018 · 6 comments
Milestone

Comments

@thautwarm
Copy link
Owner

thautwarm commented Aug 18, 2018

Just like that in Rust.

if let (a, b) = data {
    # do something if the case is matched.
}

perspective syntax proposals:

@when (a, b) = data begin
    # do something if the case is matched.
end
# or 
@if_let (a, b) = data begin
   # do something if the case is matched.
end

feel free to make a supplementary.

@thautwarm
Copy link
Owner Author

@Roger-luo
Copy link
Collaborator

I prefer when...

@findmyway
Copy link
Collaborator

@findmyway
Copy link
Collaborator

@thautwarm
Copy link
Owner Author

thautwarm commented Aug 20, 2018

@findmyway I think when-let could be replaced by an if-let without else clause. The concept of if-let in Clojure might be better than Rust, I think, for it can accept not only a term of pattern matching but a normal bool expression is also valid.

So what's your ideal if-let syntax in Julia? @Roger-luo prefers keyword when, and so am I, but I'd admit that this could be personal preference(maybe if causes the aesthetic fatigue for its frequently regular usage).

@findmyway
Copy link
Collaborator

If that is the case, when will be fine.

@thautwarm thautwarm added this to the 0.2.0 milestone Nov 11, 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