with and binary backward compatibility

2022-06-14 Thread Remi Forax
Hi all, Let say we have a Point with 2 components record Point(int x, int y) { } Then we change the record to add a 3rd components in a more or less backward compatible way record Point(int x, int y, int z) { Point(int x, int y) { this(x, y, 0); // creation of the new value 0

Re: "With" for records

2022-06-10 Thread Remi Forax
> From: "Brian Goetz" > To: "amber-spec-experts" > Sent: Friday, June 10, 2022 2:44:51 PM > Subject: "With" for records > In > [ > https://github.com/openjdk/amber-docs/blob/master/eg-drafts/reconstruction-records-and-classes.md > | >

Re: Simplifying switch labels

2022-06-02 Thread Remi Forax
- Original Message - > From: "Brian Goetz" > To: "daniel smith" , "amber-spec-experts" > > Sent: Thursday, June 2, 2022 8:08:14 PM > Subject: Re: Simplifying switch labels >> In this framing, the restrictions about sets of elements in a single label >> don't >> apply, because we're

Re: Named record pattern

2022-06-01 Thread Remi Forax
> From: "Brian Goetz" > To: "Tagir Valeev" > Cc: "amber-spec-experts" > Sent: Tuesday, May 31, 2022 6:12:06 PM > Subject: Re: Named record pattern > Gavin reminded me that we are not finalizing patterns in switch in 19 (hard to > keep track, sometimes), so we have a little bit of time to

Re: Named record pattern

2022-05-31 Thread Remi Forax
> From: "Maurizio Cimadamore" > To: "Brian Goetz" , "Tagir Valeev" > Cc: "amber-spec-experts" > Sent: Tuesday, May 31, 2022 7:41:21 PM > Subject: Re: Named record pattern > While merging is an issue (if supported), I think early in the design we > settled > on the principle that a binding

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,

Guard variable and being effectively final

2022-05-21 Thread Remi Forax
Not sure if it's an implementation bug (bad error message from the compiler) or a spec bug, hence this message to both amber-dev and amber-spec-experts. If i try to compile this code with Java 19 (which currently still uses && instead of when for a guard) interface reverse_polish_notation {

Re: Pattern matching: next steps after JEP 405

2022-05-20 Thread Remi Forax
> From: "Brian Goetz" > To: "amber-spec-experts" > Sent: Wednesday, May 18, 2022 9:18:01 PM > Subject: Pattern matching: next steps after JEP 405 > JEP 405 has been proposed to target for 19. But, it has some loose ends that > I'd > like to refine before it eventually becomes a final feature.

Re: Pattern matching: next steps after JEP 405

2022-05-18 Thread Remi Forax
> From: "Brian Goetz" > To: "amber-spec-experts" > Sent: Wednesday, May 18, 2022 9:18:01 PM > Subject: Pattern matching: next steps after JEP 405 > JEP 405 has been proposed to target for 19. But, it has some loose ends that > I'd > like to refine before it eventually becomes a final feature.

case null / null pattern (v2)

2022-04-18 Thread Remi Forax
I've found a way to encode the null pattern if you have a record record Foo(int x) { } Foo foo = ... return switch(foo) { case Foo(int _) foo -> "i'm a foo not null here !"; case Foo fooButNull -> "i can be only null here !"; }; I wonder if allowing those two patterns, a record pattern and

Record pattern and side effects

2022-04-17 Thread Remi Forax
This is something i think we have no discussed, with a record pattern, the switch has to call the record accessors, and those can do side effects, revealing the order of the calls to the accessors. So by example, with a code like this record Foo(Object o1, Object o2) { public Object o2()

case null vs null pattern

2022-04-16 Thread Remi Forax
Hi all, i maybe wrong but it seems that the spec consider null as a kind of case instead of as a kind of pattern, which disables the refactoring that should be possible with the introduction of the record pattern. Let suppose i have a sealed type with only one implementation declared like this

Re: Evolving past reference type patterns

2022-04-16 Thread Remi Forax
> From: "Guy Steele" > To: "Brian Goetz" > Cc: "amber-spec-experts" > Sent: Saturday, April 16, 2022 4:10:06 AM > Subject: Re: Evolving past reference type patterns > Yes, this is a clear improvement to the example code. > That said, I am always (or at least now) a bit leery of language

Re: Evolving past reference type patterns

2022-04-15 Thread Remi Forax
> From: "Brian Goetz" > To: "amber-spec-experts" > Sent: Friday, April 15, 2022 10:50:27 PM > Subject: Evolving past reference type patterns [...] > There are also some small differences between the safe cast conversions and > method invocation context. There is the same issue with unboxing

Re: Primitive type patterns

2022-04-07 Thread Remi Forax
> From: "Brian Goetz" > To: "amber-spec-experts" > Sent: Thursday, April 7, 2022 9:54:11 PM > Subject: Re: Primitive type patterns > There's another, probably stronger, reason why primitive patterns supporting > widening, narrowing, boxing, unboxing, etc, are basically a forced move, > besides

Re: [External] : Re: Remainder in pattern matching

2022-03-30 Thread Remi Forax
- Original Message - > From: "Dan Heidinga" > To: "Brian Goetz" > Cc: "amber-spec-experts" > Sent: Wednesday, March 30, 2022 8:43:42 PM > Subject: Re: [External] : Re: Remainder in pattern matching > On Wed, Mar 30, 2022 at 2:38 PM Brian Goetz wrote: >> [...] > > And from your

Re: Patterns and GADTs (and type checking and inference and overload selection)

2022-03-30 Thread Remi Forax
- Original Message - > From: "Brian Goetz" > To: "amber-spec-experts" > Sent: Wednesday, March 30, 2022 9:33:21 PM > Subject: Patterns and GADTs (and type checking and inference and overload > selection) > GADTs -- sealed families whose permitted subtypes specialize the type >

Re: [External] : Re: Remainder in pattern matching

2022-03-30 Thread Remi Forax
- Original Message - > From: "Brian Goetz" > To: "Dan Heidinga" > Cc: "amber-spec-experts" > Sent: Wednesday, March 30, 2022 8:26:53 PM > Subject: Re: [External] : Re: Remainder in pattern matching [...] > > One thing wrapping gains is that it gives us a place to centralize >

Re: Remainder in pattern matching

2022-03-30 Thread Remi Forax
> From: "Brian Goetz" > To: "amber-spec-experts" > Sent: Wednesday, March 30, 2022 4:40:28 PM > Subject: Remainder in pattern matching > We should have wrapped this up a while ago, so I apologize for the late > notice, > but we really have to wrap up exceptions thrown from pattern contexts

Are binding types covariant ? Was: Declared patterns -- translation and reflection

2022-03-30 Thread Remi Forax
> From: "Brian Goetz" > To: "amber-spec-experts" > Sent: Tuesday, March 29, 2022 11:01:18 PM > Subject: Declared patterns -- translation and reflection > Time to take a peek ahead at _declared patterns_. Declared patterns come in > three varieties -- deconstruction patterns, static patterns,

Re: Declared patterns -- translation and reflection

2022-03-29 Thread Remi Forax
> From: "Brian Goetz" > To: "amber-spec-experts" > Sent: Tuesday, March 29, 2022 11:01:18 PM > Subject: Declared patterns -- translation and reflection > Time to take a peek ahead at _declared patterns_. Declared patterns come in > three varieties -- deconstruction patterns, static patterns,

Re: Declared patterns -- translation and reflection

2022-03-29 Thread Remi Forax
> From: "Brian Goetz" > To: "amber-spec-experts" > Sent: Tuesday, March 29, 2022 11:01:18 PM > Subject: Declared patterns -- translation and reflection > Time to take a peek ahead at _declared patterns_. Declared patterns come in > three varieties -- deconstruction patterns, static patterns,

Re: Pattern assignment

2022-03-28 Thread Remi Forax
> From: "Brian Goetz" > To: "amber-spec-experts" > Sent: Friday, March 25, 2022 4:38:52 PM > Subject: Pattern assignment > We still have a lot of work to do on the current round of pattern matching > (record patterns), but let's take a quick peek down the road. Pattern > assignment is a

Re: Pattern coverage

2022-03-24 Thread Remi Forax
Thanks for sharing, in the text, they are several mentions of the default pattern but the default pattern is not defined. Rémi > From: "Brian Goetz" > To: "amber-spec-experts" > Sent: Thursday, March 24, 2022 6:39:21 PM > Subject: Pattern coverage > I've put a document at > [

Record pattern: matching an empty record

2022-03-13 Thread Remi Forax
Hi all, while writing the prototype of the runtime, i found a case i think we never discuss, can we match an empty record ? record Empty() { } switch(object) { case Empty() -> ... // no binding here I think the answer is yes because i don't see why we should do a special case for that, but

Record pattern, the runtime side

2022-03-13 Thread Remi Forax
Following the discussions we had, i've implemented a prototype of what can be the runtime part of the pattern matching that supports record pattern. It works in 3 steps: Step 1, at compile time, the compiler takes all the patterns and creates a tree of pattern from the list of patterns, pattern

Re: [External] : Re: Proposal: java.lang.runtime.Carrier

2022-03-07 Thread Remi Forax
> From: "Remi Forax" > To: "Brian Goetz" > Cc: "Jim Laskey" , "amber-spec-experts" > > Sent: Saturday, March 5, 2022 11:54:14 PM > Subject: Re: [External] : Re: Proposal: java.lang.runtime.Carrier >> From: "Brian G

Re: Telling the totality story

2022-03-03 Thread Remi Forax
> From: "Brian Goetz" > To: "amber-spec-experts" > Sent: Thursday, March 3, 2022 9:42:25 PM > Subject: Telling the totality story > Given the misconceptions about totality and whether "pattern matching means > the > same thing in all contexts", it is pretty clear that the story we're telling

Re: Proposal: java.lang.runtime.Carrier

2022-03-03 Thread Remi Forax
For the pattern matching, we also need a 'with' method, that return a method handle that takes a carrier and a value and return a new carrier with the component value updated. static MethodHandle withComponent(MethodType methodType, int i) // returns a mh (Carrier;T) -> Carrier with T the

Re: Primitive type patterns

2022-02-28 Thread Remi Forax
> From: "Brian Goetz" > To: "amber-spec-experts" > Sent: Monday, February 28, 2022 5:50:25 PM > Subject: Re: Primitive type patterns > Let me put the central question here in the spotlight. >> Boxing and unboxing >> Suppose our match target is a box type, such as: >> record

Re: Primitive type patterns

2022-02-26 Thread Remi Forax
> From: "Brian Goetz" > To: "amber-spec-experts" > Sent: Friday, February 25, 2022 10:45:44 PM > Subject: Primitive type patterns > As a consequence of doing record patterns, we also grapple with primitive type > patterns. Until now, we've only supported reference type patterns, which are >

Re: Record patterns (and beyond): exceptions

2022-02-17 Thread Remi Forax
> From: "Brian Goetz" > To: "amber-spec-experts" > Sent: Wednesday, February 16, 2022 7:34:17 PM > Subject: Record patterns (and beyond): exceptions > As we move towards the next deliverable -- record patterns -- we have two new > questions regarding exceptions to answer. > Questions >

Re: Reviewing feedback on patterns in switch

2022-02-16 Thread Remi Forax
> From: "Brian Goetz" > To: "amber-spec-experts" > Sent: Wednesday, February 16, 2022 4:49:19 PM > Subject: Re: Reviewing feedback on patterns in switch > One thing that we have, perhaps surprisingly, *not* gotten feedback on is > forcing all non-legacy switches (legacy type, legacy labels,

Re: Reviewing feedback on patterns in switch

2022-02-15 Thread Remi Forax
> From: "Brian Goetz" > To: "amber-spec-experts" > Sent: Tuesday, February 15, 2022 7:50:06 PM > Subject: Re: Reviewing feedback on patterns in switch > We're preparing a third preview of type patterns in switch. Normally we would > release after a second preview, but (a) we're about to get

Re: JEP 405 update

2022-02-09 Thread Remi Forax
Hi Gavin, I don't buy the argument that record patterns promote a null-safe style of programming as this is stated several times in the JEP. The ""null-safety"" (notice the air quotes) mostly comes from the instanceof or the switch (which semantics is equivalent of a cascade of if instanceof),

Re: Control flow analysis for exhaustive pattern-switch statement

2022-02-04 Thread Remi Forax
> From: "Brian Goetz" > To: "Tagir Valeev" , "amber-spec-experts" > > Sent: Thursday, February 3, 2022 5:35:13 PM > Subject: Re: Control flow analysis for exhaustive pattern-switch statement > Thanks Tagir for digging into this. This is good analysis. > The decision to require completeness of

Re: Reviewing feedback on patterns in switch

2022-01-28 Thread Remi Forax
- Original Message - > From: "mark" > To: "Brian Goetz" > Cc: "amber-spec-experts" > Sent: Friday, January 28, 2022 12:43:55 PM > Subject: Re: Reviewing feedback on patterns in switch > On 2022-01-25T19:46:09 + > Brian Goetz wrote: > >> We’ve previewed patterns in switch for two

Feedback: refining the inference of yield type in a switch

2022-01-26 Thread Remi Forax
Here are several examples showing that the inference does work as expected from a beginner POV, the first two examples come from one of my student. Here, list is typed as List instead of List var value = ... var list = switch (value) { case 0 -> List.of(); case 1 -> List.of("foo");

Re: Positioning of guards (was: Reviewing feedback on patterns in switch)

2022-01-26 Thread Remi Forax
- Original Message - > From: "Tagir Valeev" > To: "Brian Goetz" > Cc: "amber-spec-experts" > Sent: Wednesday, January 26, 2022 4:50:05 AM > Subject: Re: Positioning of guards (was: Reviewing feedback on patterns in > switch) > Hello! > > For the record: I like the current version

Re: Treatment of total patterns (was: Reviewing feedback on patterns in switch)

2022-01-25 Thread Remi Forax
- Original Message - > From: "Tagir Valeev" > To: "Brian Goetz" > Cc: "amber-spec-experts" > Sent: Wednesday, January 26, 2022 5:20:24 AM > Subject: Re: Treatment of total patterns (was: Reviewing feedback on patterns > in switch) >> Null is only matched by a switch case that includes

Re: Treatment of total patterns (was: Reviewing feedback on patterns in switch)

2022-01-25 Thread Remi Forax
> From: "Brian Goetz" > To: "amber-spec-experts" > Sent: Tuesday, January 25, 2022 8:47:09 PM > Subject: Treatment of total patterns (was: Reviewing feedback on patterns in > switch) >> 1. Treatment of total patterns in switch / instanceof > The handling of totality has been a long and painful

Re: Positioning of guards (was: Reviewing feedback on patterns in switch)

2022-01-25 Thread Remi Forax
- Original Message - > From: "Brian Goetz" > To: "amber-spec-experts" > Sent: Tuesday, January 25, 2022 8:49:02 PM > Subject: Positioning of guards (was: Reviewing feedback on patterns in switch) >> 2. Positioning of guards > > We received several forms of feedback over the form and

Re: Patterns and GADTs (was: Reviewing feedback on patterns in switch)

2022-01-25 Thread Remi Forax
- Original Message - > From: "Brian Goetz" > To: "amber-spec-experts" > Sent: Tuesday, January 25, 2022 8:49:08 PM > Subject: Patterns and GADTs (was: Reviewing feedback on patterns in switch) >> 3. Type refinements for GADTs > > There are a number of unsatisfying aspects to how we

Re: Diamond in type patterns (was: Reviewing feedback on patterns in switch)

2022-01-25 Thread Remi Forax
- Original Message - > From: "Brian Goetz" > To: "amber-spec-experts" > Sent: Tuesday, January 25, 2022 8:49:12 PM > Subject: Diamond in type patterns (was: Reviewing feedback on patterns in > switch) >> 4. Diamond for type patterns (and record patterns) > > > The type pattern `T t`

GADT and type variable specialization during inference

2021-11-24 Thread Remi Forax
Moved to amber-spec-experts, I've got a very similar issue, if we support patter matching on Class. public Stream createPrimitiveStrem(Class type) { return switch(type) { case int.class -> new SpecializedStream(); case double.class -> new SpecializedStream(); ... };

Re: Translation musings (was: Are templated string embedded expressions "method parameters" or "lambdas"?)

2021-11-02 Thread Remi Forax
> From: "Brian Goetz" > To: "John Rose" > Cc: "amber-spec-experts" > Sent: Mardi 2 Novembre 2021 18:43:29 > Subject: Translation musings (was: Are templated string embedded expressions > "method parameters" or "lambdas"?) > I think we need to redirect a bit. >> I’m pointing out a different

Re: Are templated string embedded expressions "method parameters" or "lambdas"?

2021-10-31 Thread Remi Forax
> From: "John Rose" > To: "Guy Steele" > Cc: "Brian Goetz" , "Tagir Valeev" > , > "Jim Laskey" , "amber-spec-experts" > > Sent: Dimanche 31 Octobre 2021 01:18:38 > Subject: Re: Are templated string embedded expressions "method parameters" or > "lambdas"? > On Oct 30, 2021, at 3:22 PM, John

Yet another proposal of a templated string design

2021-10-30 Thread Remi Forax
Happy Halloween, i spend some time again thinking how to implement templated strings. >From the comments of my previous attempt, the main issues of the previous >iteration were that it was a little too magical and by using a bootstrap >method force the BSM design into the JLS. So i try to

Re: Are templated string embedded expressions "method parameters" or "lambdas"?

2021-10-29 Thread Remi Forax
> From: "Jim Laskey" > To: "amber-spec-experts" > Sent: Vendredi 29 Octobre 2021 16:10:54 > Subject: Are templated string embedded expressions "method parameters" or > "lambdas"? > For our early templated string prototypes , we restricted embedded expressions > to just basic accessors and basic

Templated String and template policies, why the current design is bad

2021-10-17 Thread Remi Forax
I've recently proposed another way to implement the templated string/template policies but i may not have made it clear why i think the current proposal [1] is bad. First, some vocabulary, a templated string is a string with some unnamed parameters that are filled with the result of

String Interpolation

2021-10-13 Thread Remi Forax
Hi everybody, i've spend some time to think how the String interpolation + Policy should be specified and implemented. The goal is to add a syntax specifying a user defined method to "interpolate" (for a lack of better word) a string with arguments. Given that it's a method, the exact

Re: Minor improvement to anonymous classes

2021-10-07 Thread Remi Forax
> From: "Kevin Bourrillion" > To: "Maurizio Cimadamore" > Cc: "Brian Goetz" , "amber-spec-experts" > > Sent: Jeudi 7 Octobre 2021 22:37:58 > Subject: Re: Minor improvement to anonymous classes > On Thu, Oct 7, 2021 at 7:37 AM Maurizio Cimadamore < [ > mailto:maurizio.cimadam...@oracle.com |

Re: Pattern Matching for switch (Second Preview)

2021-10-01 Thread Remi Forax
> From: "Gavin Bierman" > To: "Brian Goetz" > Cc: "amber-spec-experts" > Sent: Vendredi 1 Octobre 2021 14:49:01 > Subject: Re: Pattern Matching for switch (Second Preview) >> On 30 Sep 2021, at 23:25, Brian Goetz < [ mailto:brian.go...@oracle.com | >> brian.go...@oracle.com ] > wrote: >> [

Re: Pattern Matching for switch (Second Preview)

2021-09-30 Thread Remi Forax
> From: "Brian Goetz" > To: "Gavin Bierman" > Cc: "amber-spec-experts" > Sent: Vendredi 1 Octobre 2021 00:25:26 > Subject: Re: Pattern Matching for switch (Second Preview) > [ moving to a-s-e ] > I get the concern that a type pattern is no longer "just a variable > declaration"; that was a

It should be possible to type a switch expression with void

2021-09-26 Thread Remi Forax
There is a bad interaction between a lambda and a switch expression, a lambda allows its expression to be typed void but a switch expression can not be typed void, so the following code does not compile sealed interface I permits A, B {} record A() {} record B() {} public Optional

Re: Feedback on pattern matching (preview feature)

2021-09-25 Thread Remi Forax
[re-sent to amber-spec-experts instead of amber-dev] - Original Message - > From: "Brian Goetz" > To: "Vikram Bakshi" , "amber-dev" > > Sent: Samedi 25 Septembre 2021 17:28:11 > Subject: Re: Feedback on pattern matching (preview feature) > The example you cite is a peek into a feature

Re: Sealed Exception

2021-09-24 Thread Remi Forax
- Original Message - > From: "Zheka Kozlov" > To: "amber-dev" > Sent: Vendredi 24 Septembre 2021 10:30:54 > Subject: Sealed Exception > Hi! CC amber-spec-experts > > Java 17 compiler forces me to insert an unreachable catch block for the > base Exception: > > public static void

Re: String Tapas Redux: Beyond mere string interpolation

2021-09-17 Thread Remi Forax
- Original Message - > From: "Tagir Valeev" > To: "Jim Laskey" > Cc: "amber-spec-experts" > Sent: Vendredi 17 Septembre 2021 12:49:30 > Subject: Re: String Tapas Redux: Beyond mere string interpolation > It's interesting that in both Scala and JavaScript when you define > custom

Re: String Tapas Redux: Beyond mere string interpolation

2021-09-17 Thread Remi Forax
- Original Message - > From: "John Rose" > To: "Jim Laskey" > Cc: "amber-spec-experts" > Sent: Vendredi 17 Septembre 2021 08:43:29 > Subject: Re: String Tapas Redux: Beyond mere string interpolation > Yay! > > I agree with Brian’s response to Remi: Nothing new here > regarding eval

Re: String Tapas Redux: Beyond mere string interpolation

2021-09-16 Thread Remi Forax
Brian explicitly ask me to not talk about invokedynamic so i will not say that there is already an existing protocol between invokedynamic and a user defined implementation, it's the bootstrap method, Let's talk about the elephant in the room: macro. Templated Strings as currently defined is

Re: Factory methods & the language model

2021-09-14 Thread Remi Forax
- Original Message - > From: "Brian Goetz" > To: "daniel smith" , "Dan Heidinga" > > Cc: "valhalla-spec-experts" > Sent: Vendredi 10 Septembre 2021 20:25:50 > Subject: Re: Factory methods & the language model >> I'm not particularly interested in settling on a bikeshed color, but am

merging cases in between values and types

2021-09-08 Thread Remi Forax
Hi all, the current spec support merging/fallthrough cases only when there is a case null, like case null, case Integer i -> // i can use 'i' here First, i'm not sure it's clearly written in the spec, i was not able to pinpoint the rule allowing it. Then i wonder if this special behavior is

Re: Reiterate total pattern accepting null in switch

2021-09-06 Thread Remi Forax
- Original Message - > From: "Brian Goetz" > To: "Tagir Valeev" , "amber-spec-experts" > > Sent: Lundi 6 Septembre 2021 15:46:19 > Subject: Re: Reiterate total pattern accepting null in switch > On 9/6/2021 5:12 AM, Tagir Valeev wrote: >> Hello! >> >> Now, as we develop support in

switch expression with not explicit yield value should work ?

2021-08-29 Thread Remi Forax
Another case where the spec is weird, i've converted a project that generate a visitor from a grammar (something like yacc) to use a switch on type instead. Sometimes for a degenerate portion of the grammar i've an empty visitor that always throw an exception, the equivalent code with a switch

Re: Switch coverage with multiple branches

2021-08-26 Thread Remi Forax
Here is another example with i believe the same issue sealed interface Vehicle {} record Car(String owner, String color) implements Vehicle {} record Bus(String owner) implements Vehicle {} public static void example2() { var vehicles = List.of( new Car("Bob", "red"),

Re: Minor improvement to anonymous classes

2021-07-31 Thread Remi Forax
> From: "Brian Goetz" > To: "amber-spec-experts" > Sent: Vendredi 30 Juillet 2021 16:52:23 > Subject: Minor improvement to anonymous classes > I have been working on a library where I've found myself repeatedly > refactoring > what should be anonymous classes into named (often local) classes,

Re: Minor improvement to anonymous classes

2021-07-31 Thread Remi Forax
- Original Message - > From: "Tagir Valeev" > To: "Brian Goetz" > Cc: "amber-spec-experts" > Sent: Samedi 31 Juillet 2021 05:55:47 > Subject: Re: Minor improvement to anonymous classes > By the way, assuming that we implement this, new IFace() {...} would > be technically equivalent to

Re: Minor improvement to anonymous classes

2021-07-31 Thread Remi Forax
> From: "John Rose" > To: "Tagir Valeev" > Cc: "Brian Goetz" , "amber-spec-experts" > > Sent: Samedi 31 Juillet 2021 20:00:20 > Subject: Re: Minor improvement to anonymous classes > On Jul 30, 2021, at 8:55 PM, Tagir Valeev < [ mailto:amae...@gmail.com | > amae...@gmail.com ] > wrote: >> 2.

Re: Minor improvement to anonymous classes

2021-07-31 Thread Remi Forax
- Original Message - > From: "John Rose" > To: "Brian Goetz" > Cc: "amber-spec-experts" > Sent: Samedi 31 Juillet 2021 00:14:46 > Subject: Re: Minor improvement to anonymous classes > It seems reasonable: If you can do this for lambdas, > which are (sort of) a concise anonymous inner

Re: Switch coverage with multiple branches

2021-07-23 Thread Remi Forax
- Original Message - > From: "daniel smith" > To: "amber-spec-experts" > Cc: "Gavin Bierman" > Sent: Samedi 24 Juillet 2021 00:28:08 > Subject: Switch coverage with multiple branches > An RFE for JEP 406 (or maybe bug fix? I haven't dug into what the spec says). > Can we make this

Re: case null and type pattern

2021-07-19 Thread Remi Forax
> From: "Brian Goetz" > To: "Gavin Bierman" , "Manoj Palat" > > Cc: "amber-spec-experts" > Sent: Lundi 19 Juillet 2021 15:00:16 > Subject: Re: case null and type pattern > Right. In theory, we could allow guarded patterns here, but they will be hard > to > use, since users will likely want to

Re: case null and type pattern

2021-07-18 Thread Remi Forax
- Original Message - > From: "Manoj Palat" > To: "amber-spec-experts" > Sent: Jeudi 15 Juillet 2021 00:43:40 > Subject: case null and type pattern > Hi Gavin, All, HI Manoj, > > In >

TypePattern and "var variable"

2021-06-29 Thread Remi Forax
I was re-reading JEP 405, 'var foo' is accepted by the grammar as Type Pattern but there is no section explicitly mentioning that. Maybe i'm wrong and 'var foo' is already supported in Java 17, if it's not the case, i think we should add a section about the Type Pattern being enhanced to support

Re: Experience with sealed classes & the "same package" rule

2021-06-22 Thread Remi Forax
> De: "John Rose" > À: "Maurizio Cimadamore" > Cc: "daniel smith" , "amber-spec-experts" > > Envoyé: Mardi 22 Juin 2021 02:31:13 > Objet: Re: Experience with sealed classes & the "same package" rule > That argument does not make sealing > less useful or more dangerous in a > non-modular

Re: Experience with sealed classes & the "same package" rule

2021-06-09 Thread Remi Forax
> De: "John Rose" > À: "daniel smith" > Cc: "amber-spec-experts" > Envoyé: Jeudi 10 Juin 2021 00:29:40 > Objet: Re: Experience with sealed classes & the "same package" rule > (Also on the same hit-list: The restriction against > using local sealed hierarchies. The restriction > doesn’t make any

Re: Experience with sealed classes & the "same package" rule

2021-06-09 Thread Remi Forax
- Mail original - > De: "daniel smith" > À: "amber-spec-experts" > Envoyé: Mercredi 9 Juin 2021 23:42:16 > Objet: Experience with sealed classes & the "same package" rule > Here's some late feedback on the sealed classes preview. Probably actionable > before 17 GA, if that's what people

case null vs case dominance

2021-06-07 Thread Remi Forax
Hi all, the first part of the message is about javac error message that could be improved, the second part is about the current spec being not very logical. With this code Object o = null; var value = switch(o) { //case null -> 0; case Object __ -> 0; case

Exhaustiveness mixing sealed type and enum

2021-06-02 Thread Remi Forax
Do we agree that the code below defines an exhaustive switch so no default is necessary ? sealed interface List permits Cons, Nil { } record Cons(String value, Object next) implements List { } enum Nil implements List { NIL } int size(List list) { return switch(list) { case Cons cons -> 1

Re: Rehabilitating switch -- a scorecard

2021-05-19 Thread Remi Forax
> De: "Brian Goetz" > À: "amber-spec-experts" > Envoyé: Mercredi 19 Mai 2021 13:12:43 > Objet: Re: Rehabilitating switch -- a scorecard > So, here's another aspect of switches rehabilitation, this time in terms of > syntactic rewrites. By way of analogy with lambdas, there's a sequence of > x

Re: Rehabilitating switch -- a scorecard

2021-05-18 Thread Remi Forax
- Mail original - > De: "Brian Goetz" > À: "John Rose" > Cc: "amber-spec-experts" > Envoyé: Mardi 18 Mai 2021 04:37:55 > Objet: Re: Rehabilitating switch -- a scorecard >> There are a few roads not taken: “switch ()” with boolean >> case expressions has not showed itself worthy yet. >

Re: Rehabilitating switch -- a scorecard

2021-05-17 Thread Remi Forax
> De: "Brian Goetz" > À: "amber-spec-experts" > Envoyé: Lundi 17 Mai 2021 23:36:30 > Objet: Rehabilitating switch -- a scorecard > This is a good time to look at the progress we've made with switch. When we > started looking at extending switch to support pattern matching (four years > ago!) we

Re: Switch labels (null again), some tweaking

2021-04-27 Thread Remi Forax
> De: "Maurizio Cimadamore" > À: "Brian Goetz" , "amber-spec-experts" > > Envoyé: Mardi 27 Avril 2021 16:23:20 > Objet: Re: Switch labels (null again), some tweaking > On 23/04/2021 16:38, Brian Goetz wrote: >> So, I think the "a switch only accepts null if the letters n-u-l-l are >>

Re: Make all switches exhaustive?

2021-04-27 Thread Remi Forax
> De: "Brian Goetz" > À: "amber-spec-experts" > Envoyé: Mardi 27 Avril 2021 19:11:18 > Objet: Make all switches exhaustive? > Maurizio's comment got me thinking about a possible way to eliminate the sharp > edge of "sometimes switches are type-checked for exhaustiveness, and sometimes > not."

Re: Switch labels (null again), some tweaking

2021-04-25 Thread Remi Forax
I just want to add that there is another possible semantics than having case null + total pattern as null acceptable pattern. We have based the semantics of pattern matching to the semantics of the cascade of if instanceof with an else at the end. There is another one, method calls [1], a

Re: Switch labels (null again), some tweaking

2021-04-23 Thread Remi Forax
- Mail original - > De: "John Rose" > À: "Brian Goetz" > Cc: "amber-spec-experts" > Envoyé: Vendredi 23 Avril 2021 21:27:40 > Objet: Re: Switch labels (null again), some tweaking > On Apr 23, 2021, at 8:38 AM, Brian Goetz wrote: >> >> ...The fact is that the natural interpretation of

Re: Possible refinement for sealed classes

2021-04-01 Thread Remi Forax
> De: "Brian Goetz" > À: "amber-spec-experts" > Envoyé: Jeudi 1 Avril 2021 15:23:28 > Objet: Possible refinement for sealed classes > Been working with sealed classes a lot lately, and have run into a pattern > that > we might want to consider supporting more directly, which is interfaces that

Re: Draft JEP: Sealed Classes

2021-03-22 Thread Remi Forax
> De: "Gavin Bierman" > À: "amber-spec-experts" > Envoyé: Lundi 22 Mars 2021 13:03:31 > Objet: Draft JEP: Sealed Classes > Dear all, > Now JDK 16 is out (yay!) it’s time for us to focus on finalizing Sealed > Classes > in JDK 17. > I have written a draft JEP, which is unchanged (other than

Type pattern and raw type

2021-03-15 Thread Remi Forax
Hi, currently when there is an instanceof + type pattern with a raw type, javec doesn't raise any warning (oops), worst it compiles because i believe it should not, but for that, the spec has to be amended. interface Foo { void set(T t); } class FooImpl implements Foo { private

Re: [External] : Re: Looking ahead: pattern assignment

2021-03-13 Thread Remi Forax
De: "Brian Goetz" À: "Remi Forax" Cc: "amber-spec-experts" Envoyé: Samedi 13 Mars 2021 02:41:58 Objet: Re: [External] : Re: Looking ahead: pattern assignment BQ_BEGIN BQ_BEGIN BQ_BEGIN Minimally, we have to align the semantics of local variabl

Re: Looking ahead: pattern assignment

2021-03-12 Thread Remi Forax
> De: "Alan Malloy" > À: "Brian Goetz" > Cc: "amber-spec-experts" > Envoyé: Vendredi 12 Mars 2021 22:58:44 > Objet: Re: Looking ahead: pattern assignment > try-with-resources is a little more subtle than the other contexts. Suppose > that > I write: > try (Foo(Bar x) = ...) { > ... > } >

Re: Looking ahead: pattern assignment

2021-03-12 Thread Remi Forax
> De: "Brian Goetz" > À: "amber-spec-experts" > Envoyé: Vendredi 12 Mars 2021 20:58:40 > Objet: Looking ahead: pattern assignment > While this is not on the immediate horizon, I think we are ready to put the > pieces together for pattern assignment. I think we now understand the form > this >

Re: Guards redux

2021-03-12 Thread Remi Forax
- Mail original - > De: "Gavin Bierman" > À: "John Rose" > Cc: "amber-spec-experts" > Envoyé: Vendredi 12 Mars 2021 11:11:46 > Objet: Re: Guards redux > Thanks everyone for the discussion. I have updated the JEP: > > http://openjdk.java.net/jeps/8213076 > > It proposes *guarded

Re: Guards redux

2021-03-10 Thread Remi Forax
> De: "Brian Goetz" > À: "Gavin Bierman" , "amber-spec-experts" > > Envoyé: Mercredi 10 Mars 2021 16:02:10 > Objet: Re: Guards redux > This feels like we landed in a good place. It preserves the underlying goal of > the original approach -- that we can compose patterns with patterns, and >

Re: Guards redux

2021-03-10 Thread Remi Forax
- Mail original - > De: "Gavin Bierman" > À: "amber-spec-experts" > Envoyé: Mercredi 10 Mars 2021 15:47:30 > Objet: Guards redux > Okay, so it seems like our initial stab at guards and a pattern conjunction > operator needs some finessing. > > Here's another take, inspired by Guy's

Re: Guards

2021-03-09 Thread Remi Forax
Apart from what have said about letting grobble to fully access to the bindings, i think that using parenthesis to call grobble here is already too much. case Foo(var x) when x > y is far more readable than case Foo(var x) when (x > y) because for a pattern the parenthesis describes a

Re: Two new draft pattern matching JEPs

2021-03-03 Thread Remi Forax
- Mail original - > De: "Gavin Bierman" > À: "amber-spec-experts" > Envoyé: Jeudi 18 Février 2021 13:33:20 > Objet: Two new draft pattern matching JEPs > Dear all, > [...] > > - Pattern Matching for switch: > https://bugs.openjdk.java.net/browse/JDK-8213076 > > We split them up to

Re: [External] : Pattern assignment statements (extracted from: Primitive type patterns and conversions)

2021-03-03 Thread Remi Forax
- Mail original - > De: "Brian Goetz" > À: "Tagir Valeev" > Cc: "amber-spec-experts" > Envoyé: Mardi 2 Mars 2021 18:44:27 > Objet: Re: [External] : Pattern assignment statements (extracted from: > Primitive type patterns and conversions) >> A couple of other things to consider: >> 1.

Re: Two new draft pattern matching JEPs

2021-03-03 Thread Remi Forax
- Mail original - > De: "Gavin Bierman" > À: "amber-spec-experts" > Envoyé: Jeudi 18 Février 2021 13:33:20 > Objet: Two new draft pattern matching JEPs > Dear all, > > The next steps in adding pattern matching to Java are coming! I have drafted > two > new JEPs: I'm slowly trying to

Deserialization of a linked list of records

2021-02-26 Thread Remi Forax
[sent to both email list given it's not clear if it's an implementation issue or a spec issue] There is a nice video of how the serialization of records works recently on inside.java https://inside.java/2021/02/23/records-met-serialization/ In the video, Julia explains that the

Pattern Matching in Python

2021-02-11 Thread Remi Forax
Hi all, in the news, Python have been accepted the PEP 642, Pattern Matching in Python [1]. The accepted PEP is https://www.python.org/dev/peps/pep-0642/ And the rational is https://www.python.org/dev/peps/pep-0635/ Compared to us, - bindings are visually like variables not a special keyword (a

  1   2   3   4   >