Re: Feedback on Sealed Types

2019-05-01 Thread John Rose
On May 1, 2019, at 5:32 AM, Remi Forax wrote: > > If there is only one constant of type Empty and the construction is typesafe, > it can be a huge win. If Empty is an inline (value) type with no components, then Empty.default is the singleton, and there's nothing else to say about it. This is

Re: Feedback on Sealed Types

2019-05-01 Thread forax
> De: "Brian Goetz" > À: "Remi Forax" > Cc: "Alan Malloy" , "amber-spec-experts" > > Envoyé: Mercredi 1 Mai 2019 14:37:23 > Objet: Re: Feedback on Sealed Types >> It may solve the enclosing issue because the ';' syntactically separate A, B >> and >> C from the content of I which is declared af

Re: Feedback on Sealed Types

2019-05-01 Thread Brian Goetz
> >> 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 sugg

Re: Feedback on Sealed Types

2019-05-01 Thread Brian Goetz
> 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

Re: Feedback on Sealed Types

2019-05-01 Thread Remi Forax
> De: "Brian Goetz" > À: "Alan Malloy" > Cc: "amber-spec-experts" > Envoyé: Lundi 29 Avril 2019 23:01:17 > Objet: Re: Feedback on Sealed Types > It would be nice if we could "just" overload enum itself to support a > record-like option: > enum Node { > AddNode(Node a, Node b), > MulNode(Node a