<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div><br></div><div><br></div><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From: </b>"Brian Goetz" <brian.goetz@oracle.com><br><b>To: </b>"amber-spec-experts" <amber-spec-experts@openjdk.java.net><br><b>Sent: </b>Tuesday, March 29, 2022 11:01:18 PM<br><b>Subject: </b>Declared patterns -- translation and reflection<br></blockquote></div><div data-marker="__QUOTED_TEXT__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><font size="4"><font face="monospace">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. </font></font></blockquote><div><br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>Once we have pattern methods, we can have an interface that defines a pattern method and a class that implement it,<br data-mce-bogus="1"></div><div>something like<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>interface I {<br data-mce-bogus="1"></div><div> foo() (Object, int); // fake syntax: the first parenthesis are the parameters, the seconds are the binding types<br data-mce-bogus="1"></div><div>}<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>class A implements I {<br data-mce-bogus="1"></div><div> foo() (String, int) { ... }<br data-mce-bogus="1"></div><div>}<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>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).<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>In that case, are we are in trouble with the translation strategy ?<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>Rémi<br data-mce-bogus="1"></div><div><br></div></div></div></body></html>