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

support await in pattern guards #26

Closed
retronym opened this issue Jul 25, 2013 · 2 comments · Fixed by #237
Closed

support await in pattern guards #26

retronym opened this issue Jul 25, 2013 · 2 comments · Fixed by #237
Milestone

Comments

@retronym
Copy link
Member

If possible.

In the meantime, I'll prohibited them explicitly.

@retronym
Copy link
Member Author

Some brainstorming:

(42: Int) match {
  case P1 if G1 => E1 // assume that G1 suspends, G2 does not.
  case P2 if G2 => E2
  case P3 => E3
}

// translate to:

val temp = foo

def match1() = {
  temp match {
    case P1 =>
      if (G1) E1
      else match2()
    case _ =>
      match2()
  }

def match2() = {
  temp match {
    case P2 if G2 => E2
    case _ => match3()
  }
}

def match3() = {
  temp match {
    case P3 => P4
  }
}

match1()

// But, we lose exhaustiveness/unreachability analysis by doing this,
// not to mention common sub-pattern elimination.

@retronym
Copy link
Member Author

Prototype of this idea: master...retronym:ticket/26

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

Successfully merging a pull request may close this issue.

1 participant