Path: csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: James Kuyper Newsgroups: comp.lang.c,comp.lang.java.programmer Subject: Re: Self-updating relationship Date: Wed, 02 Sep 2015 17:14:37 -0400 Organization: Self Lines: 37 Message-ID: <55E766BD.3060303@verizon.net> References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Injection-Info: mx02.eternal-september.org; posting-host="39e08c8e41e420e151f672c73609c593"; logging-data="22509"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+LwMMgnnatxH1z9QLX7Sj02p/Hpm5r9e0=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 In-Reply-To: Cancel-Lock: sha1:tGEwIrZN2AmR9JktvamjdBtdFwE= Xref: csiph.com comp.lang.c:69036 comp.lang.java.programmer:32467 On 09/02/2015 04:18 PM, Stefan Ram wrote: > Newsgroups: comp.lang.c,comp.lang.java.programmer > > Richard Heathfield writes: >> the programmer. In this case, it was this comment that led me to realise >> that the OP was interpreting his "spaces = height - number;" statement >> as defining some kind of self-updating relationship (like a spreadsheet >> formula). > > FWIW, in Java, one /can/ program in this way. > > public final class Main > { public static void main( final java.lang.String[] args ) > { > > final javafx.beans.property.IntegerProperty height > = new javafx.beans.property.SimpleIntegerProperty( 10 ); > > final javafx.beans.property.IntegerProperty number > = new javafx.beans.property.SimpleIntegerProperty( 2 ); > > final javafx.beans.binding.NumberBinding spaces = > height.subtract( number ); > > java.lang.System.out.println( spaces.getValue() ); > > height.set( 20 ); > > java.lang.System.out.println( spaces.getValue() ); }} /* prints: > > 8 > 18 */ What's the java feature that makes "spaces" above update automatically? To put it another way - if I didn't want such updates, what should I write differently?