New candidate JEP: 506: Scoped Values

Davor Hrg hrgdavor at gmail.com
Sat Apr 19 05:23:29 UTC 2025


Hi,

I was wondering, if I create a library that uses scoped value,
and for some reason I am unable to prevent the user from running something
without providing the scoped value.

Is there a performance hit if I set up a static method that would guard
.get() and throw a more descriptive
error to what needs to be done to use the library correctly ?

If there is a performance hit, it would be nice to be able to define
additional custom message when
scoped value is not present and an error is thrown.





On Mon, Apr 14, 2025 at 9:43 PM Mark Reinhold <mark.reinhold at oracle.com>
wrote:

> https://openjdk.org/jeps/506
>
>   Summary: Introduce scoped values, which enable a method to share
>   immutable data both with its callees within a thread, and with child
>   threads.  Scoped values are easier to reason about than thread-local
>   variables.  They also have lower space and time costs, especially when
>   used together with virtual threads (JEP 444) and structured concurrency
>   (JEP 505).
>
> - Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20250419/de1c4e79/attachment.htm>


More information about the loom-dev mailing list