Re: It's the data, stupid !

2022-05-30 Thread Brian Goetz
The problem is not at callee site, as you said you have deconstructor binding like you have constructor parameter, the problem is at callsite, when you have a Type Pattern, a type pattern does not declare a type that can be used at compile time but a class that is used at runtime (to do the ins

Re: It's the data, stupid !

2022-05-30 Thread forax
> From: "Brian Goetz" > To: "Remi Forax" > Cc: "amber-spec-experts" > Sent: Monday, May 30, 2022 8:40:33 PM > Subject: Re: It's the data, stupid ! >> The problem is that what you propose is a leaky abstraction, because pattern >

Re: It's the data, stupid !

2022-05-30 Thread Brian Goetz
The problem is that what you propose is a leaky abstraction, because pattern matching works on classes and not on types, so it's not a reverse link. ("Leaky abstraction" is sort of an inflammatory term.) What I think you're getting at is that some objects will have state that you can "put

Re: It's the data, stupid !

2022-05-30 Thread forax
> From: "Brian Goetz" > To: "Remi Forax" > Cc: "amber-spec-experts" > Sent: Monday, May 30, 2022 6:40:22 PM > Subject: Re: It's the data, stupid ! >> First, i've overlook the importance of the record pattern as a check of th

Re: It's the data, stupid !

2022-05-30 Thread Brian Goetz
First, i've overlook the importance of the record pattern as a check of the shape of the data. Then if we say that data are more important than code and that the aim of the pattern matching is to detect changes of the shapes of the data, it changes the usefulness of some features/patterns.

Re: It's the data, stupid !

2022-05-30 Thread forax
> From: "Brian Goetz" > To: "Remi Forax" , "amber-spec-experts" > > Sent: Monday, May 30, 2022 4:31:19 PM > Subject: Re: It's the data, stupid ! > Indeed, this is a big part of the motivation. And it's not just pattern > matchi

Re: It's the data, stupid !

2022-05-30 Thread Brian Goetz
Indeed, this is a big part of the motivation.  And it's not just pattern matching; its the combination of records (representing data as data), sealed classes (the other half of algebraic data types, enabling richer data-as-data descriptions), and pattern matching (ad-hoc polymorphism, great for

It's the data, stupid !

2022-05-30 Thread Remi Forax
Hi all, i think the recent discussions about the pattern matching are too much about details of implementation and i fear we are losing the big picture, so let me explain why i (we ?) want to add pattern matching to Java. Java roots is OOP, encapsulation serves us well for the last 25+ years, it