Timeouts in structured concurrency
Remi Forax
forax at univ-mlv.fr
Fri Dec 19 07:16:00 UTC 2025
For me you can not really use ADTs as return value of the subtasks
because the default joiners do not have a way to define what is a success and what is a failure.
So you can use ADTs internally but at some point, if a variant represent a failure, you have to convert it to an exception.
regards,
Rémi
----- Original Message -----
> From: "Alan Bateman" <alan.bateman at oracle.com>
> To: "Eric Kolotyluk" <eric at kolotyluk.net>, "loom-dev" <loom-dev at openjdk.org>
> Sent: Friday, December 19, 2025 8:02:21 AM
> Subject: Re: Timeouts in structured concurrency
> On 19/12/2025 01:24, Eric Kolotyluk wrote:
>> :
>>
>> So while Joiners make join() result-producing and more configurable,
>> the failure channel is still exception-based. From that perspective, I
>> can still see value in a functional, value-oriented result type—where
>> success and failure are both represented explicitly as
>> values—coexisting alongside exceptions, rather than routing expected
>> failure exclusively through throws.
>
> With records, sealed classes, pattern matching, ... then you should have
> enough to have the outcome from your own Joiner use ADTs to abstract
> over the success and failures cases. Maybe try that and write up your
> experiences?
>
> -Alan
More information about the loom-dev
mailing list