Re: Towards member patterns

2024-01-26 Thread forax
> From: "Brian Goetz" > To: "Remi Forax" > Cc: "amber-spec-experts" > Sent: Friday, January 26, 2024 7:11:29 PM > Subject: Re: Towards member patterns >>> - We basically agree that at the use site, we have all the qualification >>&

Re: Towards member patterns

2024-01-26 Thread Brian Goetz
 - We basically agree that at the use site, we have all the qualification modes we have with methods { constructor qualified with package, static member qualified with type, instance member qualified with receiver } , and possibly, an additional mode of "instance qualified b

Re: Towards member patterns

2024-01-26 Thread forax
> From: "Brian Goetz" > To: "Remi Forax" > Cc: "amber-spec-experts" > Sent: Friday, January 26, 2024 6:30:33 PM > Subject: Re: Towards member patterns >>> (It could also be a default pattern; works the same as default methods.)

Re: Towards member patterns

2024-01-26 Thread Brian Goetz
(It could also be a default pattern; works the same as default methods.)  The implementation in emptyList always fails.  The implementation in ArrayList might look like:     public __inverse List withElement(T element) {     if (that.size > 0)     _yield tha

Re: Towards member patterns

2024-01-26 Thread forax
> From: "Gavin Bierman" > To: "Remi Forax" > Cc: "Brian Goetz" , "amber-spec-experts" > > Sent: Friday, January 26, 2024 1:36:22 PM > Subject: Re: Towards member patterns > Hi Remi, >> On 26 Jan 2024, at 11:08, Remi Forax

Re: Towards member patterns

2024-01-26 Thread forax
> From: "Brian Goetz" > To: "Remi Forax" > Cc: "amber-spec-experts" > Sent: Friday, January 26, 2024 1:31:54 PM > Subject: Re: Towards member patterns >> I think your proposal solves the cases where the type you are switching on is >>

Re: Towards member patterns

2024-01-26 Thread Brian Goetz
AN easy example is regular expressions.  We have a class j.u.regex.Pattern, which represents a compiled regex.  A regular expression match is a form of pattern match (there's a match candidate, it is conditional, if it succeeds we extract the capture groups.)  Surely we should expose a "ma

Re: Towards member patterns

2024-01-26 Thread Gavin Bierman
Hi Remi, On 26 Jan 2024, at 11:08, Remi Forax wrote: Let's retry. I think your proposal solves the cases where the type you are switching on is closed (final, sealed) but not if the type is open (non-sealed). Let's take an example, let suppose I've the following hierarchy public sealed inte

Re: Towards member patterns

2024-01-26 Thread Brian Goetz
I think your proposal solves the cases where the type you are switching on is closed (final, sealed) but not if the type is open (non-sealed). A bold claim!  Let's see how this stacks up. Let's take an example, let suppose I've the following hierarchy public sealed interface Tree { ..

Re: Towards member patterns

2024-01-26 Thread Remi Forax
return list; } I really think that not using 'that' as the receiver when calling an inverse instance method is a missing opportunity because without that (again :) ), there is no way to call an inverse abstract method, so no way to pattern match on an open hierarchy. regard

Re: Towards member patterns

2024-01-24 Thread Brian Goetz
Hello, I agree until the section 'Recovering static factory arguments', because at that point, it's the tail waging the dog. I'm not sure which is tail and which is dog here, but it sure sounds like you are saying "the entire premise of this exercise is flawed, so we should throw all this w

Re: Towards member patterns

2024-01-24 Thread Remi Forax
Original Message - > From: "Brian Goetz" > To: "amber-spec-experts" > Sent: Tuesday, January 23, 2024 8:57:51 PM > Subject: Re: Towards member patterns > I was told that the formatting of the earlier version was borked, so > re-sending, hopefully wit

Re: Towards member patterns

2024-01-23 Thread Brian Goetz
I was told that the formatting of the earlier version was borked, so re-sending, hopefully without any formatting this time # Towards member patterns Time to check in on where things are in the bigger picture of patterns as class members.  Note: while this document may have illustrative

Towards member patterns

2024-01-22 Thread Brian Goetz
# Towards member patterns Time to check in on where things are in the bigger picture of patterns as class members.  Note: while this document may have illustrative examples, you should not take that as a definitive statement of syntax, and Remi will not be commenting on the syntax at this