[External] : Re: Rehabilitating switch -- a scorecard

Guy Steele guy.steele at oracle.com
Tue May 18 19:33:45 UTC 2021


> On May 18, 2021, at 2:19 PM, Brian Goetz <brian.goetz at oracle.com> wrote:
> 
> 
>>>>   - tuple as first class citizen
>>> Sorry, no.  I know you really want this, but this is similar to the
>>> function-type-vs-functional-interface issue.  We made our choice when we
>>> did records -- records are our tuples.
>> I'm hunting around deconstructor and methods that returns several values.
> 
> I know that, and I'm telling you these are not the droids you are looking for.

If only we had tail calls. Then instead of writing

(int q, int r) = quotientAndRemainder(m, n);
whatever

we could write (using my preferred syntax for a mandatory tail call in Java)

goto quotientAndRemainder(m, n, (int q, int r) -> whatever);

(the method quotientAndRemainder would of course tail-call its third argument), with no need of tuples or even records to get multiple values out of a method, and then everyone would be happy, right?  RIGHT?  :-) :-/ :-P

—Guy


More information about the amber-spec-experts mailing list