A peek at the roadmap for pattern matching and more

John Rose john.r.rose at oracle.com
Fri Aug 14 00:17:42 UTC 2020


On Aug 13, 2020, at 4:53 PM, forax at univ-mlv.fr wrote:
> 
> use it as an anonymous carrier of values to transfer the values from a plain old class to a representation you can do destructuring on it

Yes, something like that could play a role in reifying
a “bundle of names coming out of a block”, just as an
object of  functional interface reifies a lambda expressions
with an ad hoc block (“with a bundle of incoming names
and an outgoing value”).

Put another way:  Anonymous named records have the
same information content as the result of a set (unordered)
of assignments to typed names.  Hmm…  Does Java have
a syntax for that?  Could be sugar for constructing values
of that type.

In short:  I like those anonymous records, and have
already proposed some good sugar for creating them.

And if you have a API point with named parameters
that takes them positionally (the way the JVM likes
them), there are various fruitful ways to spread out
an anonymous record into the correct argument positions
(starting with a new anti-varargs rule, and an extension
to MH.invokeWithArguments).  And, given that, you
*could* (but *shouldn’t*) write that kind of ugly code
that Guy was calling “not Java”.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20200813/e109be32/attachment.htm>


More information about the amber-spec-experts mailing list