From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,42b96374c851ce5a X-Google-Attributes: gid103376,public From: me@me Subject: Re: Ada for numerics computation (i.e. forget Fortran ?) Date: 1999/04/27 Message-ID: <7g4av3$bgd@drn.newsguy.com>#1/1 X-Deja-AN: 471457290 References: <372083A1.45A5EB97@t-online.de> <7fqeua$ih8$1@pegasus.csx.cam.ac.uk> <8790bhslfz.fsf@bglbv.my-dejanews.com> <7fvbth$4m4$1@news.rz.uni-karlsruhe.de> <7fvpl8$mpm@drn.newsguy.com> <7g1e20$t12$1@wanadoo.fr> <7g1n08$8t8$1@news.rz.uni-karlsruhe.de> <7g1qcm$o4$2@pegasus.csx.cam.ac.uk> Organization: Newsguy News Service [http://www.newsguy.com] Newsgroups: comp.lang.ada Date: 1999-04-27T00:00:00+00:00 List-Id: In article <7g1qcm$o4$2@pegasus.csx.cam.ac.uk>, mgk25@cl.cam.ac.uk says... > >The childish hype surrounding "Javajavajava" is what has most of all >turned me a bit against this language. But hype sells ! I think the reason for Java popularity is that people in general were not happy with C++ (too complicated, etc..) , and wanted a different OO language, and Java came at the right time, and it looked like C++ to keep the crowds happy. One thing that I did not see many discuss about java, is its default use of references. What I do not like in Java, is that it is not 'value' based by default. meaning, when I write (where A and B are objects): A = B; then I go and modify the value of object B in some other part of the program, this results in A's value also being modified. This is a side effect of the fact that in Java, objects are references, hence in the above assignment, A takes on the same reference as B, making A and B references to the same 'object' data on the heap. (In simpler terms, A and B point to the same object on the heap). (this one time caused subtle a bug in one of my programs, when I started learning Java, as I was used to value-based languages, untill I noticed this. I was 'saving' objects in a vector, then reading new values into the source objects, but this was also causing the objects in the vector to change indirectly). To make A get its own value of the object B, one needs to be explicit and write A = B.clone(); (Assuming B supports the clone() method). So, in Java, to get the value, you need to be explicit, else you get the reference (pointer). In Ada, (and C++), they are value based, i.e. the default in assignment is to get the value of the object. If you need to get a reference, you need to be explicit. Some people might not consider this a big deal, and can get used to it (as with LISP). For me, I find that I spend more mental energy while programming in Java for the above reason, to watch out for when I need to use clone() or not. I do not have this problem with value based languages, such as Ada. What do you like more? or think is better, value-based assignments, or reference based? (I assume you would prefer value-based if you are an Ada programmer). me.