> From: "Brian Goetz" <brian.go...@oracle.com> > To: "amber-spec-experts" <amber-spec-experts@openjdk.java.net> > 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, and instance > patterns (corresponding to constructors, static methods, and instance > methods.) > I'm going to start with deconstruction patterns, but the basic game is the > same > for all three. Once we have pattern methods, we can have an interface that defines a pattern method and a class that implement it, something like interface I { foo() (Object, int); // fake syntax: the first parenthesis are the parameters, the seconds are the binding types } class A implements I { foo() (String, int) { ... } } Do we agree that a binding type can be covariant ? (before saying no, think about generics that's the reason we have return type covariance in Java). In that case, are we are in trouble with the translation strategy ? Rémi