"class object" vs. "classobject" vs. "object"


#1

As far as I understand "http://kotlinlang.org/docs/reference/classes.html">class object" is meant to be a single term and not a class named "object", but that is exactly what it looks like at first! Wouldn't it be possible to eleminate the word "class" from class objects? The single anonymous object within a class would then be the class object.

Instead of

  class C() {
  class object {
  fun create() = C()
  }
  }

simply

  class C() {
  object {
  fun create() = C()
  }
  }

But probably it’s too late for such changes …


#2

Well, the class object syntax is likely to be reconsidered, although not exactly along those lines you are suggesting. We will consider your proposal too, though.


#3

Good to know, that you want to rethink class objects.

Since class objects are not inherited (what wouldn’t make much sense), it would be plausible to place them outside of the class like Scalas companion objects. It would be obvious then, that the companion object wouldn’t be inherited.