Author Topic: Default implementation of AnyRef.eq method  (Read 748 times)

Offline ggmohan

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
    • View Profile
Default implementation of AnyRef.eq method
« on: February 03, 2016, 12:32:12 PM »

down vote
I am newbie to scala and exploring the scala source code to get the concrete understanding. When I refer the scala.AnyRef class to understand the implementation of eq method, I can see the below definition and it is confusing,

final def eq(that: AnyRef): Boolean = sys.error("eq")

Since this methods has sys.error,How and what is the logic eq follows to check that two objects are same? where can we see that implementation?

The same question apply for hascode() method.

And why Any.scala and AnyRef.scala is not part of scala package? I can see only AnyValues.scala under Scala package.