On Fri, 14 Oct 2022 16:19:02 GMT, Andy Goryachev <ango...@openjdk.org> wrote:

>> Changing the documentation for `When` should not be part of this PR I think. 
>> What we should do maybe is add a note that this method should not be 
>> confused with `Bindings.when`. I'll let others weigh in.
>
> I like `conditionOn`.

I actually like `asLongAs` that was mentioned in another comment, but it looks 
odd :)

Lately, as I was reading some unrelated codebases and I came up with 
`updateWhile` (or `updateWhen`). The reason is that names like `when` and 
`conditionOn`, and even the restricted `if` and `while`, tell me just half the 
story. They tell me what happens "when", but not what happens "when not". The 
`bindings.When` binding is phrased as "`when` condition `then` A, `otherwise` 
B", which is I think it great. This binding is phrased as "`when` condition", 
but then what and what otherwise?

Because the binding updates its value when/while/as long as the condition holds 
and *doesn't update when the condition doesn't hold* (it just stays the same), 
I think that the phrasing "`update while` condition" (and don't update while 
not condition) gives a better description of the functionality.

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

PR: https://git.openjdk.org/jfx/pull/830

Reply via email to