RFR: JDK-8286666: JEP 429: Implementation of Scoped Values (Incubator) [v6]

Andrew Haley aph at openjdk.org
Wed Nov 16 11:06:51 UTC 2022


On Tue, 15 Nov 2022 21:28:29 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> This comment is on orElse but I suspect you are suggesting that get() be changed to return Optional. I think we'll need to get more feedback/usage of this API before re-visiting that.
>
> Yes, my comment was really on `get` - that said, I note that saying get().get() would look odd (but maybe finding some other name for `ScopedValue::get`, such as `find` might work)

It certainly would look odd. This API is, by design, as lightweight as it possibly can be, both from an implementation and a user's point of view. It's also intended to be as close as possible to an "invisible" parameter passed to all callees. From that point of view, `get()` is a wart. `get().get()` is just...

-------------

PR: https://git.openjdk.org/jdk/pull/10952


More information about the hotspot-dev mailing list