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

Remi Forax forax at univ-mlv.fr
Wed Mar 30 09:59:20 UTC 2022


> From: "Brian Goetz" <brian.goetz at oracle.com>
> To: "amber-spec-experts" <amber-spec-experts at 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 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20220330/5ffa4767/attachment.htm>


More information about the amber-spec-experts mailing list