Re: RFR: 8331189: Implementation of Scoped Values (Third Preview) [v2]

2024-05-30 Thread Maurizio Cimadamore
On Wed, 29 May 2024 15:35:41 GMT, Alan Bateman  wrote:

>> JEP 481 proposes Scoped Values to continue to preview in JDK 23 with one 
>> change. The type of the operation parameter of the callWhere method is 
>> changed to a new functional interface to avoid having the API throw 
>> Exception. With that change, the getWhere (and the corresponding method on 
>> Carrier) are no longer needed. The functional interface is not proposed for 
>> j.u.function at this time.
>
> Alan Bateman has updated the pull request with a new target base due to a 
> merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains seven additional 
> commits since the last revision:
> 
>  - Merge
>  - Merge
>  - Merge
>  - Set JEP number
>  - Sync up from loom repo
>  - Merge
>  - Initial commit

Changes look good. I like how the new functional interface makes the API seem 
smaller.

-

Marked as reviewed by mcimadamore (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/19136#pullrequestreview-2088433436


Re: RFR: 8331189: Implementation of Scoped Values (Third Preview) [v2]

2024-05-29 Thread Alan Bateman
> JEP 481 proposes Scoped Values to continue to preview in JDK 23 with one 
> change. The type of the operation parameter of the callWhere method is 
> changed to a new functional interface to avoid having the API throw 
> Exception. With that change, the getWhere (and the corresponding method on 
> Carrier) are no longer needed. The functional interface is not proposed for 
> j.u.function at this time.

Alan Bateman has updated the pull request with a new target base due to a merge 
or a rebase. The incremental webrev excludes the unrelated changes brought in 
by the merge/rebase. The pull request contains seven additional commits since 
the last revision:

 - Merge
 - Merge
 - Merge
 - Set JEP number
 - Sync up from loom repo
 - Merge
 - Initial commit

-

Changes:
  - all: https://git.openjdk.org/jdk/pull/19136/files
  - new: https://git.openjdk.org/jdk/pull/19136/files/744e8665..b2166e66

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=19136&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19136&range=00-01

  Stats: 25898 lines in 731 files changed: 16263 ins; 5627 del; 4008 mod
  Patch: https://git.openjdk.org/jdk/pull/19136.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19136/head:pull/19136

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


Re: RFR: 8331189: Implementation of Scoped Values (Third Preview)

2024-05-21 Thread Jaikiran Pai
On Wed, 8 May 2024 09:40:38 GMT, Alan Bateman  wrote:

> JEP 481 proposes Scoped Values to continue to preview in JDK 23 with one 
> change. The type of the operation parameter of the callWhere method is 
> changed to a new functional interface to avoid having the API throw 
> Exception. With that change, the getWhere (and the corresponding method on 
> Carrier) are no longer needed. The functional interface is not proposed for 
> j.u.function at this time.

The changes look OK to me.

-

Marked as reviewed by jpai (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/19136#pullrequestreview-2068941921


Re: RFR: 8331189: Implementation of Scoped Values (Third Preview)

2024-05-21 Thread Jaikiran Pai
On Wed, 8 May 2024 09:40:38 GMT, Alan Bateman  wrote:

> JEP 481 proposes Scoped Values to continue to preview in JDK 23 with one 
> change. The type of the operation parameter of the callWhere method is 
> changed to a new functional interface to avoid having the API throw 
> Exception. With that change, the getWhere (and the corresponding method on 
> Carrier) are no longer needed. The functional interface is not proposed for 
> j.u.function at this time.

src/java.base/share/classes/java/lang/ScopedValue.java line 494:

> 492: 
> 493: /**
> 494:  * An operation that returns a result and may throw an exception.

Nit - should it be "or may throw an exception"?

-

PR Review Comment: https://git.openjdk.org/jdk/pull/19136#discussion_r1608511614


Re: RFR: 8331189: Implementation of Scoped Values (Third Preview)

2024-05-21 Thread ExE Boss
On Wed, 8 May 2024 09:40:38 GMT, Alan Bateman  wrote:

> JEP 481 proposes Scoped Values to continue to preview in JDK 23 with one 
> change. The type of the operation parameter of the callWhere method is 
> changed to a new functional interface to avoid having the API throw 
> Exception. With that change, the getWhere (and the corresponding method on 
> Carrier) are no longer needed. The functional interface is not proposed for 
> j.u.function at this time.

src/java.base/share/classes/java/lang/ScopedValue.java line 500:

> 498: @PreviewFeature(feature = PreviewFeature.Feature.SCOPED_VALUES)
> 499: @FunctionalInterface
> 500: public interface CallableOp {

I feel like that a functional interface such as this one should be promoted to 
a top‑level type in some common package by the time this feature exits preview.

-

PR Review Comment: https://git.openjdk.org/jdk/pull/19136#discussion_r1596041552


Re: RFR: 8331189: Implementation of Scoped Values (Third Preview)

2024-05-21 Thread Andrew Haley
On Wed, 8 May 2024 09:40:38 GMT, Alan Bateman  wrote:

> JEP 481 proposes Scoped Values to continue to preview in JDK 23 with one 
> change. The type of the operation parameter of the callWhere method is 
> changed to a new functional interface to avoid having the API throw 
> Exception. With that change, the getWhere (and the corresponding method on 
> Carrier) are no longer needed. The functional interface is not proposed for 
> j.u.function at this time.

Thanks. That all looks reasonable enough, and gets us to the status quo ante + 
`ScopedValue.CallableOp`,  which is way better than what we have right now.

-

Marked as reviewed by aph (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/19136#pullrequestreview-2066514531