RFR: JDK-8286666: JEP 429: Implementation of Scoped Values (Incubator) [v6]
ExE Boss
duke at openjdk.org
Wed Nov 16 12:52:10 UTC 2022
On Wed, 16 Nov 2022 12:11:45 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> We expect isBound() will be used a lot and I think that is clearer (and cheaper) than find().isEmpty().
>>
>> Time will tell on orElse/orElseThrow and whether they should be replaced with an Optional view. That is, I think your comments mostly apply to those two methods rather than get/isBound.
>
> Note that `isBound` can also be explained as just a shorcut for `find().isEmpty()`. That is, I'm not really suggesting to drop sugary methods from the API. But by exposing the optional nature of the result, the API might end up being more composable.
>
> But, as you said, we don't have to decide now.
Note that `ScopedValue` can currently be bound to `null`, but by using `Optional`, there would be no way to differentiate an unbound `ScopedValue` from one bound to `null`.
-------------
PR: https://git.openjdk.org/jdk/pull/10952
More information about the core-libs-dev
mailing list