Feedback on Sealed Types
brian.goetz at oracle.com
Wed May 1 12:37:23 UTC 2019
> It may solve the enclosing issue because the ';' syntactically separate A, B and C from the content of I which is declared after the ';', so A, B and C can be top-level.
Trying to make these top level has the same “how do I find the source file” problem that aux classes have.
> I kind a like the intellectual separation between
> - a sealed interface which represent a closed type and requires a permit clause and
> - an enum interface which represent a sum type which is sugar on top of sealed interface + records.
This does have a certain appeal, as each construct underscores what it is for. On the other hand, the return-on-sugar for the second is just not that big (unlike with records or enums). Basically, you get to drop the word “record” and “implements I” a bunch of times — not clear it carries its weight.
More information about the amber-spec-observers