[External] : Re: StructuredTaskScope and Futures

Florian Schmaus flow at cs.fau.de
Wed Jan 4 16:48:54 UTC 2023


On 04/01/2023 17.17, Ron Pressler wrote:
>> On 4 Jan 2023, at 15:54, forax at univ-mlv.fr <mailto:forax at univ-mlv.fr> 
>> wrote:
>> Each call returns Result | Exception.
>> So all calls are a (Result1 | Exception1) x (Result2 | Exception2) x ...
>> If you reduce it, you get a Result x Exception.

I always wondered if it would be helpful if StructuredTaskScope had

List<V> results()
List<Throwable> exceptions()

As Remi wrote, it is sometimes useful to inspect the failure cases, 
e.g., to check if it was a sporadic or persistent failure. Similar, it 
is sometimes good to have access to all results. For example to fall 
back to other results in case a result is not usable.


> If, on the other hand, having 
> access to a richer Future object is useful in *many* situations, then 
> we’ll keep things as they are, but that’s what I’m trying to ascertain.

I don't feel like I have enough experience from my experiments with Loom 
and its API to answer that.

But couldn't fork() return a superclass of Future? This would allow the 
API to change in a backwards-compatible way in case a reason to return 
Future is discovered.

- Florian


More information about the loom-dev mailing list