Re: RFR: JDK-8304439: Subscription based listeners [v2]

2023-07-11 Thread Kevin Rushforth
On Wed, 14 Jun 2023 19:35:19 GMT, Kevin Rushforth wrote: >> John Hendrikx has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Move Subscription method for invalidations to Observable >> >> - moved Subscription class to the Observable pa

Re: RFR: JDK-8304439: Subscription based listeners [v2]

2023-07-11 Thread John Hendrikx
On Wed, 14 Jun 2023 19:35:19 GMT, Kevin Rushforth wrote: >> John Hendrikx has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Move Subscription method for invalidations to Observable >> >> - moved Subscription class to the Observable pa

Re: RFR: JDK-8304439: Subscription based listeners [v2]

2023-06-29 Thread John Hendrikx
On Wed, 28 Jun 2023 15:05:24 GMT, John Hendrikx wrote: >>> My suggestion is to have the following new operations: >>> >>> * `subscribe` (`Runnable`, `Consumer`, `BiConsumer`) >> >> This seems reasonable. I could be talked into the longer names, but I prefer >> the overloaded `subscribe` name.

Re: RFR: JDK-8304439: Subscription based listeners [v2]

2023-06-28 Thread Kevin Rushforth
On Sat, 24 Jun 2023 19:23:10 GMT, Michael Strauß wrote: > My suggestion is to have the following new operations: > > * `subscribe` (`Runnable`, `Consumer`, `BiConsumer`) This seems reasonable. I could be talked into the longer names, but I prefer the overloaded `subscribe` name. > * `subscrib

Re: RFR: JDK-8304439: Subscription based listeners [v2]

2023-06-28 Thread John Hendrikx
On Wed, 28 Jun 2023 15:02:22 GMT, Kevin Rushforth wrote: >> I prefer `subscribe` with overloads, as this comes closest to the existing >> naming scheme of JavaFX listener operations (`addListener` / >> `removeListener` with overloads). >> >> I would also like to see a subscription-style API th

Re: RFR: JDK-8304439: Subscription based listeners [v2]

2023-06-24 Thread Michael Strauß
On Fri, 23 Jun 2023 22:28:57 GMT, Andy Goryachev wrote: >>> On that same topic of naming methods: >>> >>> What do people think of `Subscription#unsubscribe`? Should it be `cancel`? >>> Something else? Okay as it is? >> >> OK as is. Especially if we go with one of the two choices with "subscrib

Re: RFR: JDK-8304439: Subscription based listeners [v2]

2023-06-23 Thread Andy Goryachev
On Fri, 23 Jun 2023 21:58:37 GMT, Kevin Rushforth wrote: >>> | invalidation | values | changes | >>> |---|---|---| >>> |`subscribe(Runnable)`(*)|`subscribe(Consumer)`(*)|`subscribe(BiConsumer)`(*)| >>> |`subscribeInvalidations(Runnable)`|`subscribeValues(Consumer)`|`subscribeChanges(BiConsumer)`|

Re: RFR: JDK-8304439: Subscription based listeners [v2]

2023-06-23 Thread Kevin Rushforth
On Fri, 23 Jun 2023 21:57:03 GMT, Kevin Rushforth wrote: >> On that same topic of naming methods: >> >> What do people think of `Subscription#unsubscribe`? Should it be `cancel`? >> Something else? Okay as it is? >> >> Code example: >> >> if (subscription != null) { >> s

Re: RFR: JDK-8304439: Subscription based listeners [v2]

2023-06-23 Thread Kevin Rushforth
On Fri, 16 Jun 2023 09:45:04 GMT, John Hendrikx wrote: >> I agree that the chosen names `invalidation`, `changes` and `values` are a >> bit terse. The whole signature (without reading docs) should make it clear >> you are creating a subscription, but perhaps we can do better. The use of >> `

Re: RFR: JDK-8304439: Subscription based listeners [v2]

2023-06-16 Thread John Hendrikx
On Fri, 16 Jun 2023 09:42:45 GMT, John Hendrikx wrote: >> I think the three newly added methods are a good choice. I wonder if we can >> some up with better names, though. without some verb like "add" or >> "subscribe" in the name, the name doesn't really indicate that it is adding >> a new li

Re: RFR: JDK-8304439: Subscription based listeners [v2]

2023-06-16 Thread John Hendrikx
On Wed, 14 Jun 2023 19:26:01 GMT, Kevin Rushforth wrote: >> Yeah I'm aware they want to add this, but it doesn't really invalidate my >> point as that syntax is terrible still. Method references are far preferred >> whenever possible. >> >> I stand by my point that using the observable parame

Re: RFR: JDK-8304439: Subscription based listeners [v2]

2023-06-14 Thread Kevin Rushforth
On Mon, 17 Apr 2023 23:42:37 GMT, Nir Lisker wrote: >> John Hendrikx has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Move Subscription method for invalidations to Observable >> >> - moved Subscription class to the Observable package

Re: RFR: JDK-8304439: Subscription based listeners [v2]

2023-06-14 Thread Kevin Rushforth
On Thu, 20 Apr 2023 08:28:20 GMT, John Hendrikx wrote: >> These example would probably look like this in the near future: >> ``` java >> minimumWidthProperty().addListener(this::requestLayout()); >> minimumWidthProperty().addListener(_ -> this.requestLayout()); >> >> selectedItem.addListener(get

Re: RFR: JDK-8304439: Subscription based listeners [v2]

2023-06-14 Thread Kevin Rushforth
On Mon, 27 Mar 2023 14:36:45 GMT, John Hendrikx wrote: >> Makes `Subscription` public (removing some of its methods that are >> unnecessary), and adds methods that can provide `Subscription`s in >> `ObservableValue`. > > John Hendrikx has updated the pull request incrementally with one addition

Re: RFR: JDK-8304439: Subscription based listeners [v2]

2023-04-20 Thread John Hendrikx
On Tue, 18 Apr 2023 00:54:53 GMT, Michael Strauß wrote: >> This would depend I think how you want to approach this. I added three >> variants, invalidations, changes and values. Using the same name >> `subscribe`, you need to make sure the lambda's used all have a different >> arity, or you'

Re: RFR: JDK-8304439: Subscription based listeners [v2]

2023-04-17 Thread Michael Strauß
On Tue, 18 Apr 2023 00:36:22 GMT, John Hendrikx wrote: >> modules/javafx.base/src/main/java/javafx/beans/Observable.java line 107: >> >>> 105: * @since 21 >>> 106: */ >>> 107: default Subscription invalidations(Runnable subscriber) { >> >> I think re-using `InvalidationListener` m

Re: RFR: JDK-8304439: Subscription based listeners [v2]

2023-04-17 Thread John Hendrikx
On Mon, 10 Apr 2023 19:18:42 GMT, Michael Strauß wrote: >> John Hendrikx has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Move Subscription method for invalidations to Observable >> >> - moved Subscription class to the Observable pac

Re: RFR: JDK-8304439: Subscription based listeners [v2]

2023-04-17 Thread John Hendrikx
On Mon, 17 Apr 2023 23:42:10 GMT, Nir Lisker wrote: >> John Hendrikx has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Move Subscription method for invalidations to Observable >> >> - moved Subscription class to the Observable package

Re: RFR: JDK-8304439: Subscription based listeners [v2]

2023-04-17 Thread Michael Strauß
On Tue, 18 Apr 2023 00:04:27 GMT, John Hendrikx wrote: > There is still some use for the standard listener methods; there are some > rare cases where having the `Observable` or `ObservableValue` parameter is > actually useful. I'd prefer to drop this parameter from the subscription > variants

Re: RFR: JDK-8304439: Subscription based listeners [v2]

2023-04-17 Thread John Hendrikx
On Mon, 17 Apr 2023 23:48:54 GMT, Nir Lisker wrote: > Just took a quick look. > > Ideally, we would not split the world into subscriptions and listeners. > Adding a return type to `addListener` and `removeListener` is source > compatible, but not binary. Is this something that we strictly can'

Re: RFR: JDK-8304439: Subscription based listeners [v2]

2023-04-17 Thread Michael Strauß
On Tue, 18 Apr 2023 00:04:27 GMT, John Hendrikx wrote: > Just took a quick look. > > Ideally, we would not split the world into subscriptions and listeners. > Adding a return type to `addListener` and `removeListener` is source > compatible, but not binary. Is this something that we strictly c

Re: RFR: JDK-8304439: Subscription based listeners [v2]

2023-04-17 Thread Nir Lisker
On Mon, 27 Mar 2023 14:36:45 GMT, John Hendrikx wrote: >> Makes `Subscription` public (removing some of its methods that are >> unnecessary), and adds methods that can provide `Subscription`s in >> `ObservableValue`. > > John Hendrikx has updated the pull request incrementally with one addition

Re: RFR: JDK-8304439: Subscription based listeners [v2]

2023-04-10 Thread Michael Strauß
On Mon, 27 Mar 2023 14:36:45 GMT, John Hendrikx wrote: >> Makes `Subscription` public (removing some of its methods that are >> unnecessary), and adds methods that can provide `Subscription`s in >> `ObservableValue`. > > John Hendrikx has updated the pull request incrementally with one addition

Re: RFR: JDK-8304439: Subscription based listeners [v2]

2023-03-27 Thread John Hendrikx
> Makes `Subscription` public (removing some of its methods that are > unnecessary), and adds methods that can provide `Subscription`s in > `ObservableValue`. John Hendrikx has updated the pull request incrementally with one additional commit since the last revision: Move Subscription method