diff options
author | Geoffrey Washburn <geoffrey.washburn@epfl.ch> | 2008-02-28 14:01:58 +0000 |
---|---|---|
committer | Geoffrey Washburn <geoffrey.washburn@epfl.ch> | 2008-02-28 14:01:58 +0000 |
commit | 13731d7f327ffcc3f368ef27e56c3d458c52e1f5 (patch) | |
tree | 8da73f0c548328218fd12b083d9123649bc96234 /src/library | |
parent | 95c1e8dacd28bf1dfbb66bbe67b742e0c35270aa (diff) | |
download | scala-13731d7f327ffcc3f368ef27e56c3d458c52e1f5.tar.gz scala-13731d7f327ffcc3f368ef27e56c3d458c52e1f5.tar.bz2 scala-13731d7f327ffcc3f368ef27e56c3d458c52e1f5.zip |
Removed stub methods, and moved the contractual...
Removed stub methods, and moved the contractual obligations text to the
trait description.
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/Ordered.scala | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/src/library/scala/Ordered.scala b/src/library/scala/Ordered.scala index 07d283dc3a..1e3911918f 100644 --- a/src/library/scala/Ordered.scala +++ b/src/library/scala/Ordered.scala @@ -13,7 +13,22 @@ package scala /** A class for totally ordered data. * - * Note that since version 2006-07-24 this class is no longer covariant in a. + * Note that since version 2006-07-24 this class is no longer covariant in a. + * + * It is important that the equals method for an instance of + * Ordered[A] be consistent with the compare method. However, + * due to limitations inherent in the type erasure semantics, + * there is no reasonable way to provide a default implementation + * of equality for instances of Ordered[A]. Therefore, if you need + * to be able to use equality on an instance of Ordered[A] you must + * provide it yourself either when inheiriting or instantiating. + * + * It is important that the hashCode method for an instance of + * Ordered[A] be consistent with the compare method. However, + * it is not possible to provide a sensible default implementation. + * Therefore, if you need to be able compute the hash of an + * instance of Ordered[A] you must provide it yourself either when + * inheiriting or instantiating. * * @author Martin Odersky * @version 1.1, 2006-07-24 @@ -34,27 +49,5 @@ trait Ordered[A] { def >= (that: A): Boolean = (this compare that) >= 0 def compareTo(that: A): Int = compare(that) - /** It is important that the equals method for an instance of - * Ordered[A] be consistent with the compare method. However, - * due to limitations inherent in the type erasure semantics, - * there is no reasonable way to provide a default implementation - * of equality for instances of Ordered[A]. Therefore, if you need - * to be able to use equality on an instance of Ordered[A] you must - * provide it yourself either when inheiriting or instantiating. - * Therefore, the default implementation will fail with an error to - * prevent you from forgetting to do so. */ -// Breaks the build FIX!! -// override def equals(other : Any) : Boolean = -// error("You must implement equals for Ordered yourself.") - - /** It is important that the hashCode method for an instance of - * Ordered[A] be consistent with the compare method. However, - * it is not possible to provide a sensible default implementation. - * Therefore, if you need to be able compute the hash of an - * instance of Ordered[A] you must provide it yourself either when - * inheiriting or instantiating. Therefore, the default implementation - * will fail with an error to prevent you from forgetting to do so. */ -// Breaks the build FIX!! -// override def hashCode : Int = -// error("You must implement hashCode for Ordered yourself.") + } |