Why does `ScopedValue.where(SCOPE_VALUE, val).call()` throw Exception?

Holo The Sage Wolf holo3146 at gmail.com
Thu Mar 23 16:59:45 UTC 2023


A possibly better solution is to create:

```java
    @FunctionalInterface
    interface GCallable<R, E extends Throwable> {
        R call() throws E;
    }
```
And use this interface.
It will require changing the signature of `Carrier#runWith` (and hence
modifying `JVM_FindScopedValueBindings`) and of 3 methods in
`ScopedValueContainer` (alternatively only changing the signature of
`Carrier#runWith` and the implementation of `ScopedValueContainer#call`),
but everything else could be left unchanged, and letting Java infer the
exception needed.

On Thu, Mar 23, 2023 at 6:32 PM Andrew Haley <aph-open at littlepinkcloud.com>
wrote:

> On 3/23/23 11:16, Kasper Nielsen wrote:
> > So I would really like something like
> >   <R> R supply(Supplier<? extends R> op);
> > on ScopedValue.Carrier
>
> What would supply() do? Just like call() but without an exception?
>
> --
> Andrew Haley  (he/him)
> Java Platform Lead Engineer
> Red Hat UK Ltd. <https://www.redhat.com>
> https://keybase.io/andrewhaley
> EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
>
>

-- 
Holo The Wise Wolf Of Yoitsu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20230323/18db0cc3/attachment.htm>


More information about the loom-dev mailing list