java - Why does `ScalaObject` exist? -
why scala classes inherit scalaobject
although trait empty , has no (visible?) functionality compared anyref
, define additional methods?
won't slow down method calls equals()
or hashcode()
because need take class consideration (which might override methods)?
isn't possible fold anyref , scalaobject 1 class?
update: scalaobject was eradicated new 2.10 version of scala.
scalaobject
inserts $tag
method, which, according comment in library source code 2.7, "is needed optimizing pattern matching expressions match on constructors of case classes." since name starts $
, should of course considered "hidden" application programmers. in scala 2.8, it's entirely empty, guess it's there backward compatibility.
Comments
Post a Comment