https://kotlinlang.org logo
Title
d

Daniel

12/30/2018, 2:06 PM
Might it be planned to make the
{ }
optional when writing a anonymous class?
object  : xyz(...) {   }
Seems like a minor inconsistency since they are optional with 'normal' classes
g

gildor

12/30/2018, 2:37 PM
Probably make sense to create an issue
d

Dico

12/30/2018, 4:26 PM
But what is the point of
object : xyz(...) {}
vs.
xyz(...)
Only difference is when you use reflection
d

Daniel

12/30/2018, 6:05 PM
xyz could be abstract for example
g

gildor

01/02/2019, 10:17 AM
abstract class without abstract methods? For sure it’s possible, but probably not a most common case
d

Dico

01/02/2019, 10:18 AM
There's a good reason for them to be optional with normal classes, not with anonymous ones.
A reason for them not to be optional with anonymous class is that if you don't override something, you probably didn't intend for there to be an anonymous class