logo       

Re: pattern matching works strange for an O'Caml programmer: msg#00249

lang.scala

Subject: Re: pattern matching works strange for an O'Caml programmer

> Even later, I made it into this:
> abstract class Expr {
> def eval: int = this match {
> case Number(n) => n
> case Sum(x, 0) => 0
> }
> }
> case class Number(n: int) extends Expr
> case class Sum(e1: Expr, e2: Expr) extends Expr
>
> The type error didn't showed up either.

This looks like a bug to me, especially since version 2.2.0 is the first
version to accept such a program. It might have to do with the
experimental addition of unnaply patterns, but I let Buraq detail on that.

Cheers,
Iulian



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise