Quantcast
Channel: default
Viewing all articles
Browse latest Browse all 10

A good reason to use sealed traits and classes in Scala

$
0
0

A good reason to use sealed traits and classes in Scala

This scala-lang.org documentation page shares a good reason to use “sealed” traits and classes: When you created sealed traits, the compiler can easily tell all of the subtypes of your class or trait, and as just one benefit, you don’t need to add a default, “catch-all” case in your Scala match expressions.


Viewing all articles
Browse latest Browse all 10

Trending Articles