# Braces should be optional for object expressions

**URL:** <https://discuss.kotlinlang.org/t/braces-should-be-optional-for-object-expressions/12365>\
**Category:** Language Design\
**Created:** [April 16, 2019, 9:11pm UTC](https://discuss.kotlinlang.org/t/braces-should-be-optional-for-object-expressions/12365 "2019-04-16T21:11:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dan.lugg](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/dan.lugg/32/6256_2.png) [@dan.lugg](https://discuss.kotlinlang.org/u/dan.lugg)\
**Post date:** [April 16, 2019, 9:11pm UTC](https://discuss.kotlinlang.org/t/braces-should-be-optional-for-object-expressions/12365/1 "2019-04-16T21:11:29Z")

</div>

In many cases, an object expression is used to override functionality:

```
val o = object : SomeInterface {
    override fun doSomething() {
        println("Hello!")
    }
}

```

However, when using an object expression to extend an abstract class (that has no abstract members remaining) the braces can be extraneous when you’re not overriding anything:

```
val o = object : SomeAbstractClass() {
    // nobody's home
}

```

I propose that the object expression braces be made optional, such that when there are no member definitions needed for a valid object expression, they can be omitted:

```
val o = object : SomeAbstractClass()

```

Thanks!

---

<div class="post-metadata">

**Author:** ![benwoodworth](https://avatars.discourse-cdn.com/v4/letter/b/ad7895/32.png) [@benwoodworth](https://discuss.kotlinlang.org/u/benwoodworth)\
**Post date:** [January 3, 2020, 6:48am UTC](https://discuss.kotlinlang.org/t/braces-should-be-optional-for-object-expressions/12365/2 "2020-01-03T06:48:26Z")

</div>

In cases like these, wouldn’t it make sense to make `SomeAbstractClass` an open, non-abstract class? There aren’t any abstract members, and that way it can be instantiated without an object expression.
