Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #27403

Re: The Assignment Principle

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From markspace <markspace@nospam.nospam>
Newsgroups comp.lang.java.programmer
Subject Re: The Assignment Principle
Date Sun, 26 Jan 2014 14:27:13 -0800
Organization A noiseless patient Spider
Lines 39
Message-ID <lc4243$fqg$1@dont-email.me> (permalink)
References <assignment-principle-20140126210852@ram.dialup.fu-berlin.de>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Sun, 26 Jan 2014 22:27:16 +0000 (UTC)
Injection-Info mx05.eternal-september.org; posting-host="5aa64ebf9a53573f97c75abba936b0e2"; logging-data="16208"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ugOjsMPdtBnB6sxYyqt9NFnVUAgdXrjs="
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0
In-Reply-To <assignment-principle-20140126210852@ram.dialup.fu-berlin.de>
Cancel-Lock sha1:AGHjhJxFCEXnuvsD0IvWtLuXy7U=
Xref csiph.com comp.lang.java.programmer:27403

Show key headers only | View raw


On 1/26/2014 12:17 PM, Stefan Ram wrote:
>    Also, it is
>    about values and not expressions, so that
>
> v = java.lang.Math.random();


Well, most often it is about expressions:

   a = 2;
   b = 1;
   v = a * a + b;
   System.out.println( v == 5 );

Had darn well better print 'true';

Math.random() is kind of an exception, as well as NaN, which has its own 
semantics for comparisons.

It's fair to point out that objects have states, and method invocation 
often returns different values based on their internal state.

   InputStream in = ...
   v = in.read();

Is going to return a different value for each invocation, generally 
speaking.

We're getting into the difference between traditional languages, which 
do have state, and functional languages, which try to avoid mutable 
state whenever possible.  Functional languages try to mimic the behavior 
of algebra and mathematics, so that's why they look a lot closer the 
mathematical formulas and properties you are used to from that field.

But Java isn't functional programming, and those properties you learned 
for algebra aren't going to always work here.  Thus, learning Java 
involves learning a new set of rules, not trying to make Java work like 
the other set of rules.

Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Re: The Assignment Principle markspace <markspace@nospam.nospam> - 2014-01-26 14:27 -0800
  Re: The Assignment Principle Robert Klemme <shortcutter@googlemail.com> - 2014-01-27 18:50 +0100
    Re: The Assignment Principle markspace <markspace@nospam.nospam> - 2014-01-27 13:33 -0800
      Re: The Assignment Principle Robert Klemme <shortcutter@googlemail.com> - 2014-01-29 06:10 -0800
        Re: The Assignment Principle Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2014-01-29 16:24 +0200
  Re: The Assignment Principle FredK <fred.l.kleinschmidt@gmail.com> - 2014-01-27 12:04 -0800

csiph-web