Hi all, Why Kotlin Any type has only 3 methods equ...
# announcements
a
Hi all, Why Kotlin Any type has only 3 methods equals, hashCode and toString. While standard Java Object type has some additional ones like wait/notify
n
wait()
and
notify()
are legacy ways to do thread synchronization they have nothing to do with
Object
it just happens that since every instance traces its ancestry to
Object
, it was the right place to put them but thread sync is a cross-cutting concern and not everything needs to be object-oriented kotlin’s
Any
methods are actually generic to any instance
1
🙏 1
since you mention
Object
methods here’s an old piece of mine about
Object.clone()
that kotlin doesn’t has either https://blog.frankel.ch/cloneable-java-design-gotcha/