Extend Pattern Matching with Literals
b-studios opened this issue · comments
Originally, we supported pattern matching on literals, such as
e match {
case 1 => "one"
case _ => "other"
}
but since we moved from matching combinators to a proper compilation of pattern matching, this feature was dropped. In the meeting, yesterday, @phischu brought up that we might be able to more easily support literal matchers by first supporting guards.
That is, first support
e match {
case x if x == 1 => "one"
case _ => "other"
}
which compiles to
let x = e;
if (x == 1) "one"
else "other"
or similar. And then desugar literal matches to guards.