<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    Maybe "updatedWhen" would work, although I still like "activeWhen"
    or simply "when" better. The problem that has been raised about
    "updateWhen" is that it isn't really the right verb tense. What we
    want is a binding that is updated (or active) when the condition
    evaluates to true. The value itself isn't necessarily updated unless
    the source of the binding has been updated, and the name
    "updateWhen" might imply that it is.<br>
    <br>
    John: of the various choices, which one(s) do you like best?<br>
    <br>
    -- Kevin<br>
    <br>
    <br>
    <div class="moz-cite-prefix">On 11/21/2022 3:18 PM, Nir Lisker
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:CA+0ynh-C_nUN2MiXp6Cby2v8Q_3JTsuW-T1o6i3r2hOa6RDOPw@mail.gmail.com">
      
      <div dir="ltr">My proposal in the PR was 'updateWhen', which I
        prefer over observedWhen and activeWhen. Just 'when' is also
        fine by me and prefered over 'when'.
        <div><br>
        </div>
        <div>My only problem with 'when'/'whenever' is that they don't
          say what happens "when"/"whenever". However, since these are
          bindings, and what bindings do is update a bound value based
          on the binding, it's rather hinted what happens.</div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Tue, Nov 22, 2022 at 1:03
          AM Kevin Rushforth <<a href="mailto:kevin.rushforth@oracle.com" moz-do-not-send="true" class="moz-txt-link-freetext">kevin.rushforth@oracle.com</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">My
          initial reaction is that I like the name "activeWhen" at least
          as <br>
          well as any of the alternatives discussed so far. It's less
          wordy than <br>
          "observedWhen" (which I suggested), and probably easier to
          describe. I <br>
          don't really care for using the term "scope".<br>
          <br>
          I also think "when" or "whenever" are acceptable, but I know
          some don't <br>
          like them.<br>
          <br>
          I think the leading candidates are:<br>
          <br>
          activeWhen<br>
          whenever<br>
          when<br>
          observedWhen<br>
          <br>
          Unless someone can come up with a better name that can be
          easily <br>
          described, I recommend picking one of these.<br>
          <br>
          -- Kevin<br>
          <br>
          <br>
          On 11/21/2022 2:36 PM, Michael Strauß wrote:<br>
          > Thanks for your clarifications.<br>
          > Maybe the actual problem is that we don't have a good
          name for "gets<br>
          > the current value, but doesn't subscribe to updates".<br>
          > We could call bindings "active" when changes of the
          source value are<br>
          > processed, and "inactive" if the binding exists, but
          doesn't process<br>
          > changes.<br>
          > With a documented definition of "active", the method
          could simply be<br>
          > named `activeWhen`.<br>
          ><br>
          ><br>
          > On Mon, Nov 21, 2022 at 10:57 PM John Hendrikx <<a href="mailto:john.hendrikx@gmail.com" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">john.hendrikx@gmail.com</a>>
          wrote:<br>
          >> Hi Michael,<br>
          >><br>
          >> Thanks for your suggestion.<br>
          >><br>
          >> The effect is not quite what you describe however, as
          the initial value<br>
          >> when the operation is first invoked is retained. It's
          true however that<br>
          >> when the condition is always `false` that the value
          will be a constant,<br>
          >> and that when it is always `true` it effectively is
          just a duplicate of<br>
          >> the left hand observable.  Let me illustrate:<br>
          >><br>
          >>       public static void main(String[] args) {<br>
          >>         StringProperty sp = new
          SimpleStringProperty("foo");<br>
          >>         BooleanProperty active = new
          SimpleBooleanProperty(false); //<br>
          >> inactive<br>
          >>         ObservableValue<String> x =
          sp.when(active);  // holds "foo"<br>
          >> despite being inactive<br>
          >><br>
          >>         System.out.println(x.getValue());  // prints
          "foo"<br>
          >><br>
          >>         sp.set("bar");<br>
          >><br>
          >>         System.out.println(x.getValue());  // still
          prints "foo"<br>
          >><br>
          >>         active.set(true);<br>
          >><br>
          >>         System.out.println(x.getValue());  // prints
          "bar"<br>
          >>       }<br>
          >><br>
          >> This behavior doesn't violate the rule that the new
          binding shouldn't<br>
          >> observe its source when the condition is false as no
          listener was<br>
          >> involved to get the initial value.  The initial value
          is important as<br>
          >> all bindings must have some kind of value. The docs
          do describe this in<br>
          >> the first sentence:<br>
          >><br>
          >> "Returns an {@code ObservableValue} that holds this
          value and is updated<br>
          >> only when {@code condition} holds {@code true}"<br>
          >><br>
          >> I think `withScope` could work (or `scopedTo`) but
          not sure if "scope"<br>
          >> itself is a good description -- we'd need to update
          the description to<br>
          >> use the word scope in a way that makes clear what it
          does preferably<br>
          >> without having to resort to "updated only when" or
          "only observes when":<br>
          >> ie: "Returns an ObservableValue that is scoped to the
          given condition" ?<br>
          >><br>
          >> --John<br>
          <br>
        </blockquote>
      </div>
    </blockquote>
    <br>
  </body>
</html>