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

Holo The Sage Wolf holo3146 at gmail.com
Thu Apr 13 11:41:12 UTC 2023


I want to add an argument to push more the j.u.f.exceptionally approach I
suggested.

Just today someone in Reddit pointed out how String Templates have an
inconsistent semantics with the j.u.function package, as they have the
interface:

    @FunctionalInterface
    public interface Processor<R, E extends Throwable> {
        R process(StringTemplate st) throws E;
    }

If we had a j.u.f.exceptionally package, then not only it will be more
consistent across the the standard library, it will unify a lot of
functional interfaces:

import java.util.function.exceptionally.Function;
[...]
    @FunctionalInterface
    public interface Processor<R, E extends Throwable> extends
Function<StringTemplate, R, E> {
        R apply(StringTemplate st) throws E; // luckily, the semantics
of the word "apply" also fits for activating a processor
    }


On Thu, Apr 13, 2023 at 2:30 PM Holo The Sage Wolf <holo3146 at gmail.com>
wrote:

> > Do you have a way to help me find that Amber discussion?
>
> Here is the start of the thread:
> https://mail.openjdk.org/pipermail/amber-dev/2023-March/007849.html
>
> But the relevant part (the discussion I had with Brian Goetz) starts here:
> https://mail.openjdk.org/pipermail/amber-dev/2023-March/007858.html
>
> The end conclusion was what you probably expect it to be, but I think it
> is important discussion to have and I hope that when few features will
> finally finalize and there will be a bit of free time to the team the
> discussion will start to be active again
>
> On Thu, Apr 13, 2023 at 1:45 PM Andrew Haley <aph-open at littlepinkcloud.com>
> wrote:
>
>> On 4/13/23 11:23, Holo The Sage Wolf wrote:
>> > As a side note, generally I'm a bit disappointed
>>
>> You and everybody else.
>>
>> > from the state of
>> > exceptions with generics in Java, not too long ago I talked about it in
>> (I
>> > believe) the Amber mailing list about possible improvements in the
>> future.
>>
>> I've spent a fair bit of time discussing this kind of thing with Brian
>> Goetz
>> et al., and it's just a very hard problem. Any "Hey, let's do this!"
>> probably
>> will have some unfortunate side effects somewhere.
>>
>> Do you have a way to help me find that Amber discussion?
>>
>> --
>> 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
>


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


More information about the loom-dev mailing list