Quantcast
Channel: Sealed Class in Scala - Stack Overflow
Browsing latest articles
Browse All 3 View Live

Answer by Jatin for Sealed Class in Scala

The compiler shows a genuine warning, as simplifyExp cannot handle all arguments of type Expr. For example on doing:scala> simplifyExp(new Var("as"))scala.MatchError: Var(as) (of class Var) at...

View Article



Answer by Yann Moisan for Sealed Class in Scala

In case of simplifyExp, you use extractor composition and I think that the compiler is not smart enough to detect the problem. Obvisously, the following code fails at runtime with a...

View Article

Sealed Class in Scala

Below is my code snippet:sealed abstract class Exprcase class Var(name: String) extends Exprcase class Number(num: Double) extends Exprcase class UnOp(operator: String, arg: Expr) extends Exprcase...

View Article
Browsing latest articles
Browse All 3 View Live




Latest Images