Synchronous executor interface

Attila Kelemen attila.kelemen85 at gmail.com
Wed Aug 9 19:29:24 UTC 2023


Ron Pressler <ron.pressler at oracle.com> ezt írta (időpont: 2023. aug. 8., K,
23:54):

> Hi.
>
> I think what you’re saying is that you’d like the JDK to include a
> functional interface for the type Supplier<T> –> T. While I do see the
> logic in that, I think that Function<Supplier<T>, Supplier<T>> is not much
> more cumbersome to use (i.e., instead of `se.submit(action)` you’ll write
> `mapper.apply(action).get()`) and has the benefit of being composable.
>
> So I think your idea has merit, but I think at this point we’ll wait and
> see what coding patterns emerge before adding such a type or until the JDK
> itself requires it.
>
>
That is only partially applicable, because then I would have to fix T at
the declaration time, and I can't do that, because it can be different for
each invocation place. So, technically it should be a function of `<T> (T)
-> T` (being very liberal with my notation), but that is not even a
functional interface in Java (which actually annoys me more often than I
would have expected it).

Otherwise - obviously - I don't expect it for 21 (that would be quite
ridiculous given the September release), and to be honest such an interface
properly would only be truly relevant in the next LTS. The main benefit of
knowing it early in my opinion is that if I want to create a temporary one
for myself, then it is good to know what I will have to be compatible with.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20230809/80c43990/attachment.htm>


More information about the loom-dev mailing list