# Sealed Classes with "Forward Declarations"?

**URL:** <https://discuss.kotlinlang.org/t/sealed-classes-with-forward-declarations/1615>\
**Category:** Language Design\
**Created:** [April 20, 2016, 12:56am UTC](https://discuss.kotlinlang.org/t/sealed-classes-with-forward-declarations/1615 "2016-04-20T00:56:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SkittishSloth](https://avatars.discourse-cdn.com/v4/letter/s/8e7dd6/32.png) [@SkittishSloth](https://discuss.kotlinlang.org/u/SkittishSloth)\
**Post date:** [April 20, 2016, 12:56am UTC](https://discuss.kotlinlang.org/t/sealed-classes-with-forward-declarations/1615/1 "2016-04-20T00:56:21Z")

</div>

I might just be missing something, but it seems to me like sealed classes can get pretty unwieldly if the child classes/objects are numerous and/or large. I’m not sure how they’re implemented when the code is compiled, so no clue how plausible it’d be, but would there be any way to have the sealed class just define the name and initial details of the child, but have the actual child defined separately? Even if it’s the same file - that’d at least knock off an indentation level and make it a little more readable.

Maybe something like:

```kotlin
    sealed class MyClass {
        external class MyChild: MyClass()
    }

```

Or is there already a language feature that handles this and I’ve just missed it?

---

<div class="post-metadata">

**Author:** ![abreslav](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/abreslav/32/8279_2.png) [@abreslav](https://discuss.kotlinlang.org/u/abreslav)\
**Post date:** [April 20, 2016, 4:10pm UTC](https://discuss.kotlinlang.org/t/sealed-classes-with-forward-declarations/1615/2 "2016-04-20T16:10:58Z")

</div>

Something like this is on the table, see comments [here](https://youtrack.jetbrains.com/issue/KT-11573).

But no ETA at this time.

---

<div class="post-metadata">

**Author:** ![SkittishSloth](https://avatars.discourse-cdn.com/v4/letter/s/8e7dd6/32.png) [@SkittishSloth](https://discuss.kotlinlang.org/u/SkittishSloth)\
**Post date:** [April 20, 2016, 4:24pm UTC](https://discuss.kotlinlang.org/t/sealed-classes-with-forward-declarations/1615/3 "2016-04-20T16:24:03Z")

</div>

Awesome - thanks!
