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 ArticleAnswer 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 ArticleSealed 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
More Pages to Explore .....