Enum vs Record vs Sealed types

2020-01-02 Thread Remi Forax
Now that the design of Record is mostly stabilized, i think we should talk about the relation between an enum, a record and a sealed type. As we have done with records, we can work backward from the pattern matching switch to see what we need for an enum. So let suppose that like Java2D, we fil

Deconstructor return type as record ?

2020-01-02 Thread Remi Forax
We have introduce records because it's a simple abstraction to extract values when doing the pattern matching. Given that records are named tuples, does it means that a deconstructor is just a classical method with no parameter and a record as return type ? public class Point { private final d

Re: Deconstructor return type as record ?

2020-01-02 Thread Brian Goetz
There are at least two questions here, one having to do with records, the other having to do with pattern matching. Recall, in Lambda, how we chose to do nominal function types (functional interfaces) rather than structural ones.  Records make a similar choice -- rather than doing structural _

Re: Deconstructor return type as record ?

2020-01-02 Thread forax
> De: "Brian Goetz" > À: "Remi Forax" , "amber-spec-experts" > > Envoyé: Jeudi 2 Janvier 2020 22:22:44 > Objet: Re: Deconstructor return type as record ? > There are at least two questions here, one having to do with records, the > other > having to do with pattern matching. > Recall, in Lambd

Re: Enum vs Record vs Sealed types

2020-01-02 Thread John Rose
On Jan 2, 2020, at 12:52 PM, Remi Forax wrote: > > The other solution, is to wait to have de-constructor, in that case we may > not need a special syntax for enum. Yeah, that’s my first thought on this. Given a deconstructor which we certainly will have, the incremental advantage to record-lik