Sealed Classes with "Forward Declarations"?


#1

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:

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

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


#2

Something like this is on the table, see comments here.

But no ETA at this time.


#3

Awesome - thanks!