summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-02-28 14:35:50 +0000
committerPaul Phillips <paulp@improving.org>2010-02-28 14:35:50 +0000
commitba5dbbd44db2c23c7532cde13453c6a031afb6e5 (patch)
tree00fbae4846f215cf90efda508f924cb790537e31 /src/library
parent432e16ce906cb1f03aabe26c0e51674780f44625 (diff)
downloadscala-ba5dbbd44db2c23c7532cde13453c6a031afb6e5.tar.gz
scala-ba5dbbd44db2c23c7532cde13453c6a031afb6e5.tar.bz2
scala-ba5dbbd44db2c23c7532cde13453c6a031afb6e5.zip
Added ## method to Any as our scala hashCode me...
Added ## method to Any as our scala hashCode method which provides consistent answers for primitive types. And I'm sure we're all tired of new starrs, but it's hard to add a method to Any without one. This patch only brings ## into existence, but nothing calls it yet. // some true assertions scala> assert(5.5f.## == 5.5f.hashCode) scala> assert(5.0f.## != 5.0f.hashCode && 5.0f.## == 5L.##) No review. (Already reviewed by odersky.)
Diffstat (limited to 'src/library')
-rw-r--r--src/library/scala/runtime/ScalaRunTime.scala5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/library/scala/runtime/ScalaRunTime.scala b/src/library/scala/runtime/ScalaRunTime.scala
index ca8549bffa..a65ec05401 100644
--- a/src/library/scala/runtime/ScalaRunTime.scala
+++ b/src/library/scala/runtime/ScalaRunTime.scala
@@ -174,6 +174,11 @@ object ScalaRunTime {
case _ => false
}
+ /** Just a stub for now, but I think this is where the Predef.hash
+ * methods should be.
+ */
+ @inline def hash(x: Any): Int = Predef.hash(x)
+
/** Given any Scala value, convert it to a String.
*
* The primary motivation for this method is to provide a means for