Feedback on Sealed Types

Brian Goetz brian.goetz at
Wed May 1 13:58:12 UTC 2019

>> 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.

To be clear, I think what Alan is suggesting, and what Remi is supporting, is:

 - Make “sealed” the primitive for defining closed types, as originally proposed, and also
 - Make the following 

enumerated interface Foo {
    R(X), S(Y);


sugar for

sealed interface Foo
    permits R, S { 


    record R(X) implements Foo { }
    record S(Y) implements Foo { }

Is that correct?

More information about the amber-spec-observers mailing list