Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
codefromscala [2007/08/16 12:12] philippe.suter |
codefromscala [2007/08/16 14:13] philippe.suter |
||
---|---|---|---|
Line 5: | Line 5: | ||
* match on Some(n) / None. Option is sealed, and the completeness is already checked by the compiler.. Disjointness/irredundancy is obvious | * match on Some(n) / None. Option is sealed, and the completeness is already checked by the compiler.. Disjointness/irredundancy is obvious | ||
* match on something-really-precise (eg. Seq('X','M','L')..) and then a wildcard. Used to throw exceptions occasionnally. Not that interesting. | * match on something-really-precise (eg. Seq('X','M','L')..) and then a wildcard. Used to throw exceptions occasionnally. Not that interesting. | ||
+ | * use of match to define equals. | ||
==== From the libaries ==== | ==== From the libaries ==== | ||
Line 248: | Line 249: | ||
} | } | ||
</code> | </code> | ||
+ | |||
+ | ==== From scalacheck ==== | ||
+ | |||
+ | [[http://code.google.com/p/scalacheck/|ScalaCheck]] is interesting for (almost) toy-sized examples. It uses almost exclusively sealed classes for pattern matching, and all its (6) source files compile without any warning. So it could be interesting as an example to show that our verifications are at least as good as scalac's. | ||
+ | |||
+ |