A proposal (pre-proposal?) to add parameter groups to Java
Brian Goetz
brian.goetz at oracle.com
Fri Jul 31 20:34:24 UTC 2020
> which can be simplified to (no need to declare p1 and p2)
>
> void line(Point(var x1, var y1), Point(var x2, var y2)) { }
>
> one interesting thing is that like lambdas with functional interfaces, a record is a nominal type that can be used by inference as a structural type, so at call site, instead of writing
> line(new Point(1, 2), new Point(3, 4))
> one can write
> line((1, 2), (3, 4))
>
>
Indeed, just as functional interfaces are "nominal function types",
records are "nominal tuples". And as lambdas can be considered literals
for functional interfaces, one could _imagine_ a similar conversion for
records.
But, before we close down this thread, I just want to clarify that Remi
meant "one can write" as leaning on that imagination -- that it was
imaginable that, in some future language, such a conversion is possible
-- not that this is currently on the plan.
More information about the discuss
mailing list