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=-0.5 required=5.0 tests=BAYES_00,INVALID_MSGID, LOTS_OF_MONEY,PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,f868292008c639ce X-Google-Attributes: gid103376,public From: "Jean-Pierre Rosen" Subject: Re: Java vs. Ada - strings (was: C vs. Ada - strings) Date: 2000/06/05 Message-ID: <8hggtl$30r$1@wanadoo.fr>#1/1 X-Deja-AN: 631317229 References: <390F0D93.F835FAD9@ftw.rsc.raytheon.com> <8en5o9$ihe$1@nnrp1.deja.com> <8eonos$e70$1@wanadoo.fr> <1fIU4.4668$Rx3.250161@typhoon.nyroc.rr.com> <3924B730.AFB52C1C@acenet.com.au> <39394E0B.75BD479C@telepath.com> <8hecs2$295$1@wanadoo.fr> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 X-Complaints-To: abuse@wanadoo.fr X-Trace: wanadoo.fr 960218869 3099 193.250.53.123 (5 Jun 2000 15:27:49 GMT) Organization: Adalog X-MSMail-Priority: Normal NNTP-Posting-Date: 5 Jun 2000 15:27:49 GMT Newsgroups: comp.lang.ada Date: 2000-06-05T15:27:49+00:00 List-Id: Pete a �crit dans le message : qzB_4.10571$kf5.79533@typhoon.nyroc.rr.com... > > > 2) The Java syntax is nice - only at initialisation time. You have no > aggregates in Java, so the corresponding > syntax would not be > > allowed if you wanted to put other values in the array after > initialisation. > > i'm not sure what you mean...if i wanted to change an element of the > string array, i would just assign it > via s[i] = Here you are assigning an element, not the array. I was talking about assigning the whole array; but of course, there is no such thing as value assignment in Java... > you could also resize the array, without any looping statements > (System.arrayCopy) In ada, System.arrayCopy is called ":=". Talking about conciseness... > also > suppose the ada array (1 based) > > AR : constant String_List := (new String'("have"), new String'("a"), new > String'("good"), new String'("day")); > > i hope that i can say ar(2) := without having to > worry about contraint errors, or having to free the old ar(2) first, the > compiler should be smart enough to figure it out. String is not a variable string. If you want to have variable, unlimited strings with hidden memory allocation and automatic recollection, use Unbounded_String! As far as freeing (or collecting) memory is concerned, I hope you know that NO Java compilers does that. Garbage collection is a property of the JVM, and will apply equally to all languages running on the JVM (Java, Ada, or any other) -- --------------------------------------------------------- J-P. Rosen (Rosen.Adalog@wanadoo.fr) Visit Adalog's web site at http://pro.wanadoo.fr/adalog